Function-3: Auto-update account information across CRM.

Function-3: Auto-update account information across CRM.




Welcome back once again folks!

Last week, we learnt about round-robin assignment of records using custom functions. This week, we'll take a look at a custom function that saves your time by auto-updating all the related fields in a selected module when those fields get updated in the Accounts module.

Business scenario:

Take a case of leads captured through web-forms. Most leads don't fill out the entire form. Once the lead is prospected, you go on to create relevant records in contact and accounts module. Now that you qualified the leads, you don't want to miss out on an opportunity to collect more details, do you? When you update these details in the accounts module, you'd want these to be automatically updated in the contacts module as well. This week's custom function helps in doing just that.

And it isn't just the Contacts module that gets updated. The related fields in any selected module, including custom modules, is auto-updated using this custom function. To apply this custom function to other modules, simply update the module names and ID in the code.

Getting started with the custom function:

  1. Go to Setup > Automations > Actions > Custom Functions > Configure Custom Function > Write your own .
  2. Provide a name for the Custom function. For example: “Auto-update related fields”.
  3. Select the module as Accounts. Add a description(optional).
  4. Copy the code given below.
  5. Click “ Edit arguments ”.
  6. Enter the name as “accountId” and select the value as “Account Id”.
  7. Save the changes.
The script:

Code for Version 2.0 API:
 
relatedcontacts = zoho.crm.getRelatedRecords("Contacts", ("Accounts"), accountId.toLong()); 
//info relatedcontacts; 
for each ele in relatedcontacts 

mp=map(); 
mp.put("Contact_Type", input.type ); 
update = zoho.crm.update("Contacts", ele.get("id"), mp); 
info mp; 
info update; 


Code for Version 1.0 API:

accountIdStr=input.accountId.to.String();
relatedcontacts = zoho.crm.getRelatedRecords("Contacts", ("Accounts"), accountIdStr);
info relatedcontacts;
for each ele in relatedcontacts
{
contactId = ifnull(ele.get("CONTACTID"),"");
mp=map();
mp.put("Contact Type", input.type );
update = zoho.crm.updateRecord("Contacts", contactId, mp);
info mp;
info update;
}

Check this one out and let me know how it works! If you have questions, ask away. Share this with your team if you find it useful. See you all next week with another interesting custom function. Until then!

Update: As you must be aware, API V1.0 will be deprecated and support for version 1.0 API will be available only till Dec 31, 2018. Version 1.0 compatible Functions will continue to work until Dec 31, 2019. You're advised to migrated to API Version 2.0 at the earliest. Check this announcement for more. We've updated the post to include the Version 2.0 compatible Function.



                        Zoho Marketing Automation
                                • Sticky Posts

                                • Tip #35 - On using Kanban View in Zoho CRM

                                  Hi folks,  It's that time of the week again, and I am back with a quick tip about using Kanban View in Zoho CRM. If you think you missed any of our previous weeks' tips, you can read them here.  Tip #35 - On using Kanban View in Zoho CRM You deal with so many records in CRM every single day! When you click open each module in Zoho CRM, you have hundreds of records, each in various stages of your sales pipeline. Wouldn't it be cool if you had them all sorted automatically without having to filter
                                • Zoho User Group in-person meetups - learn and discuss Zoho at a meetup in a city near you!

                                  A big HELLO to the everyone in the Zoho Community! Another great year, another set of new challenges and another set of vibrant goals are ahead of us. We're starting the year off with the ZUG meetups for 2023 spread out globally. We're back again with
                                • Zoho User Group (ZUG) In-person Meetups - UK region

                                  Hello everyone! 

We are delighted to inform you that registration is now open for the UK Meetups taking place in May. Join us for an engaging day of learning, networking, and sharing. During this meetup, we will be exploring the nuances of customizing
                                • Focus Group Webinars - Q1 - 2023

                                  Zoho CRM can be allied with other Zoho products to operate business processes and achieve several functionalities efficiently. Generally, all of these integrations can help scale business activities and also save a lot of time. For this Quarter (Q1: 2023
                                • Tip #44: Organizing your Notes in Zoho CRM

                                  Hello folks,  It's time for this week's tip and today, let's look at how you can organize your notes for records in Zoho CRM based on your preferences.  Notes form an integral part of records and play a vital role in your Zoho CRM usage. You can keep track of the status of your individual records using notes. One quick glance at the notes, and anyone who wants to collaborate and work on the record along with you or after you, can easily know the status.  However, each person may prefer to read them


                                Manage your brands on social media



                                        Zoho TeamInbox Resources

                                          Zoho DataPrep Resources



                                            Zoho CRM Plus Resources

                                              Zoho Books Resources


                                                Zoho Subscriptions Resources

                                                  Zoho Desk Resources

                                                    Zoho Projects Resources


                                                      Zoho Sprints Resources


                                                        Qntrl Resources


                                                          Zoho Creator Resources


                                                            Zoho WorkDrive Resources



                                                              Zoho Campaigns Resources

                                                                Zoho CRM Resources

                                                                • CRM Community Learning Series

                                                                  CRM Community Learning Series


                                                                • Tips

                                                                  Tips

                                                                • Functions

                                                                  Functions

                                                                • Meetups

                                                                  Meetups

                                                                • Kbase

                                                                  Kbase

                                                                • Resources

                                                                  Resources

                                                                • Digest

                                                                  Digest

                                                                • CRM Marketplace

                                                                  CRM Marketplace

                                                                • MVP Corner

                                                                  MVP Corner

                                                                • Word of the Day

                                                                  Word of the Day


                                                                      Design. Discuss. Deliver.

                                                                      Create visually engaging stories with Zoho Show.

                                                                      Get Started Now