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.put("Contact_Type", input.type ); 
update = zoho.crm.update("Contacts", ele.get("id"), mp); 
info mp; 
info update; 

Code for Version 1.0 API:;
relatedcontacts = zoho.crm.getRelatedRecords("Contacts", ("Accounts"), accountIdStr);
info relatedcontacts;
for each ele in relatedcontacts
contactId = ifnull(ele.get("CONTACTID"),"");
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
      Zoho SalesIQ Promotion Banner
            • Sticky Posts

            • Zoho User Group (ZUG) in-person Meetups

              Hello everyone! We are delighted to announce that we've opened up registrations for ZUG Meetups, September - November 2022. We have some exciting topics to cover at our upcoming meetups, to time and again, familiarize and implement new Zoho advancements
            • CRM Hack #2: Automate sending of birthday greetings to your customers.

                Hello everyone! What sets you apart as a sales person is your ability to add that personal touch to your business relationship with your customers. Sending a gift on a special day, or leaving a note wishing them on their birthdays, are small, yet significant actions that show your customers that you care. And these are actions done without any expectations :) You must be engaging with a lot of customers and it is highly unlikely that they all are your friends on Facebook or some social channel,
            • Connect with Zoho users from your industry, virtually!

              A couple of years ago, we started setting up industry-wise channels for users with similar businesses to chat and discuss Zoho contextually. We started with Real Estate and E-commerce sectors, creating a chatroom and hosting regular meetups on niche areas
            • Zoho User Group (ZUG) in-person Meetups

              Hello Zoho Community, We're pleased to announce the next leg of Zoho User Group in-person meetups. We're thankful for your overwhelming response to the meetups last quarter. Our teams had a blast meeting you all in person and finally being able to catch
            • ZUG Virtual Meetups - February and March 2022

              Hello everyone, We have opened up registrations for the Virtual ZUG Meetups for February - March 2022. Last month, we had a great discussion with our Zoho User Groups. For the next one, we'll be discussing Subforms in Zoho CRM and integration of Zoho

            Zoho Pagesense Resources

              Zoho SalesIQ Resources

                    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

                                                      Design. Discuss. Deliver.

                                                      Create visually engaging stories with Zoho Show.

                                                      Get Started Now