transfer tags from deals to accounts

transfer tags from deals to accounts

Hello,
We are trying to transfer tags from deals to accounts. Example- We create a deal and link it to an account. In the DEALS module, we tag it "specific". We want that "specific" tag to move over to ACCOUNTS also. That way we don't have to re-tag things in ACCOUNTS when we already tagged the DEAL. Is this possible? I tried the code below but wasn't sure how to edit it to include the modules we needed to merge. 
 
acctinfo = zoho.crm.getRecordById("Accounts",acctId);
tagname = "";
tagvalue = ifnull(acctinfo.get("Tag"),"");
if(tagvalue != "")
{
for each ele in tagvalue
{
tagname = tagname + ele.get("name") + ",";
}
}
newtagname = tagname.removeLastOccurence(",").trim();
mp = Map();
mp.put("tag_names",newtagname);

relatedContacts = zoho.crm.getRelatedRecords("Contacts", "Accounts", acctId);
if(relatedContacts.size()>0)
{
for each contact in relatedContacts
{
contId = contact.get("id"); 

response = invokeurl
[
url :"https://www.zohoapis.com/crm/v2/Contacts/" + contId + "/actions/add_tags?"
type :POST
parameters:mp
connection: "connectionname"
];
info response;
}

    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