How to add/remove tag to a ticket with function?

How to add/remove tag to a ticket with function?

Hi, 
I have had to create a function in Zoho Desk. However, it appears that the syntax differs from that in CRM.
I realized that it is necessary to add organization ID in some commands what is not necessary when you create a funciotn in CRM.

Could you help me with adding and removing tags? Here is the code:
  1. ticketData = zoho.desk.getRecordById(orgID,"Tickets",Ticket_Id);
  2. // Can I get the realted Contact with the following command?
  3. contactData = zoho.desk.getRecordById(orgID,"Contacts",contactId);

  4. if(contactData.get("TRIAL") != null)
  5. {
  6.  trialDate = contactData.get("TRIAL");
  7.  if(trialDate.toDate() >= zoho.currentdate)
  8. {
  9.         ticketTags = ticketData.get("Tags");
  10. ticketTags.add("TRIAL");
  11. ticketData.put("Tags",ticketTags);
  12. zoho.desk.update(orgID,"Tickets", ticketData.get("id"), ticketdata);

  13. }

  14. }

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now