Function #41: Sync Associated Subforms!

Function #41: Sync Associated Subforms!



Welcome back everyone!

The last custom function showed how to update a Contact with Product details from it's Related list in Deals. This week, let's look at a function that lets you update subform records in two modules simultaneously when one of them is updated.

Business scenario

Let's look at how subform helps in an education institution that has deployed Zoho CRM. National Public School, Austin (made up, of course!) has set up Zoho CRM and it follows the same relationship pattern of "Students", "Teachers", "Courses", "Timings"(assume that the said names are Modules in the CRM). Let's say there are 10 students, 3 teachers, 6 classes and 8 hours per day. All these are all interlinked.

Sales data is no different. They are often updated in different modules, such as "Contacts", "Deals", "Products", etc. Hence, it becomes necessary to have many-to-many record associations.Subforms in Zoho CRM helps enable association of multiple data records across modules.

The function for this week lets users sync two subforms in the Accounts module, such that if one subform is updated, the other one gets updated too. Let's say there are two branches for a particular organization. Instead of having the entire organization's info in a single Account record, it's smarter to create multiple Accounts for branches. Hence, you need to associate the Main branch with a sub-branch as well as the sub-branches themselves.

In this function, assume 2 Accounts records, A and B, have subforms each. Every time a row (Account B) is added to subform on account A, the function adds a new subform row (Account A) to the subform on Account B. In other words, when a new branch is opened, the records of the main branch and the other branches are updated. In addition, the information about the rest of the branches are updated in the subform under the new branch.

Getting started with the custom function

  1. Go to Setup > Automation > Actions > Functions > Configure Function > Write your own.
  2. Provide a name for the function. For example: "Auto-Subform updates". Add a description (optional).
  3. Copy the code given below.
  4. Click “Edit arguments”.
  5. Enter the name as “acctId” and select the value as “Account Id”.
  6. Click Save&Execute Script to check the code.
  7. Save the function.

The Code:

-----------------------------------------------------------------------------------------------------------------------

acctDetails = zoho.crm.getRecordById("Accounts", input.acctId.toLong());
subformDetails = ifnull(acctDetails.get("Related_Accounts"),"");
count = 1;
sub_forms = List();
for each form in subformDetails
{
if ( count == 1)
{
formacctname = form.get("Related_Account").get("name");
formacctId = form.get("Related_Account").get("id");
info "formacctId:" +formacctId ;
formaccttype = ifnull(form.get("Related_Account_Type"),"");
formacctdesc = ifnull(form.get("Description"),"");
subform = Map();
subform.put("Related_Account",input.acctId);
sub_forms.add(subform);
}
count = count + 1;
}
formacctDetails = zoho.crm.getRecordById("Accounts", formacctId.toLong());
formsubformDetails = ifnull(formacctDetails.get("Related_Accounts"),"");
for each forms in formsubformDetails
{
info "formsId:" + forms.get("Related_Account").get("id");
subform1 = map();
subform1.put("Related_Account",forms.get("Related_Account").get("id"));
subform1.put("Related_Account_Type", ifnull(forms.get("Related_Account_Type"),""));
subform1.put("Description",ifnull(forms.get("Description"),""));
sub_forms.add(subform1);
}
parammap = Map();
parammap.put("Related_Accounts",sub_forms);
update = zoho.crm.update("Accounts",formacctId.toLong(),parammap);
info parammap;
info update;

-----------------------------------------------------------------------------------------------------------------------

Note:

  • The code given above works only for V2 version of Zoho APIs. Please note that the code WILL NOT work for Version 1.0 APIs.
  • Use the function in a Workflow Rule, to automate the process of update.

Found this useful? Try it out and let me know how it works! If you have questions, do not hesitate to ask! Share this with your team if you find it useful. Do check out other custom functions shared in this series here.

See you all next week with another interesting custom function. Ciao!


    • Sticky Posts

    • Function #41: Sync Associated Subforms!

      Welcome back everyone! The last custom function showed how to update a Contact with Product details from it's Related list in Deals. This week, let's look at a function that lets you update subform records in two modules simultaneously when one of them is updated. Business scenario Let's look at how subform helps in an education institution that has deployed Zoho CRM. National Public School, Austin (made up, of course!) has set up Zoho CRM and it follows the same relationship pattern of "Students",
      • Recent Topics

      • Create custom rollup summary fields in Zoho CRM

        Hello everyone, In Zoho CRM, rollup summary fields have been essential tools for summarizing data across related records and enabling users to gain quick insights without having to jump across modules. Previously, only predefined summary functions were
      • 100 record view limitation

        I have just migrated from another CRM and am starting in ZOHOcrm with over 5000 contacts. It seems that my searches and sorts are limited to 100 live records....or am I missing something. This seems to be very limiting...in a lot of scenarios (mass email,
      • Setting Up Direct Mail Campaigns

        If I need to set up a 5 step direct mail campaign is that possible? Basically every week I upload names from a CSV to Zoho and then would need to mail them every 45 days for about 6 months. I would want to be able to take names off the list when they say their house is sold or that they don't want to be contacted. I don't necessarily need to have it integrated with click2mail or anything but would at least need to be able to export the file in a CSV/excel for each mailing.  Does anyone know if that's
      • RFQ MODEL

        A Request for quotation model is used for Purchase Inquiries to multiple vendors. The Item is Created and then selected to send it to various vendors , once the Prices are received , a comparative chart is made for the user. this will help Zoho books
      • ChatGPT

        Hola, sabéis si además de tener la licencia de chat GPT Plus hay que comprar créditos para usar chat GPT en zoho social? Gracias
      • Lookup Field in Zoho Forms <> Zoho CRM Integration

        Hello, We use Zoho CRM to manage our products, create quotes, etc. I want to use Zoho Form to configure a simple form that allows customers to request quotes on our website. I completed the form and used a subform for the "Add items to your quote" part
      • Recruit - How to Force a Job Opening out of a Blueprint

        In past versions of Zoho Recruit, there was the ability to create a custom button on a record's page that would evoke a URL that would force a record out of a blueprint. What is that URL or is there a better way to force a record out of a blueprint?
      • Introducing Zia LLM: Zoho’s in-house Generative AI solution for CRM's AI capabilities

        Hello everyone, We're excited to announce the launch of our in-house Large Language Model (LLM) by Zia to power our AI offerings. What is LLM? LLM stands for Large Language Model, a powerful AI technology that processes and generates human-like text based
      • ERROR

        I deleted a contact card, I want to add it again but it says that the contact already exists. I searched the records and it is not there, and I even deleted it in the trash. The email is this one:xxxxx. Please help!!
      • How to Automatically Populate the Deal ID in the Parent Lead After Creating a New Deal with Blueprint?

        Hello Everyone! 🎉 I wanted to share a solution to a problem that some of you might have encountered. In Zoho CRM, when creating a Deal from a Lead using a Blueprint, data can only flow in one direction—from the Lead (parent) to the Deal (child). But
      • Chroniques de l'année 2024 Zoho France : avec vous, pour vous !

        Nous vous adressons nos vœux les plus chaleureux pour une année 2025 exceptionnelle et pleine de réussites ! Fidèle à son habitude, Zoho France vous réserve chaque année de nombreuses mises à jour, des événements marquants, des activités diversifiées
      • Why can't I see the delivered Zoho Campaign automation email on Zoho CRM lead record?

        I recently did update the field mapping on our Leads sync services between Zoho CRM and Zoho Campaigns. The end goal is to create tailored email drip campaigns with the use of segments and automation. I understand you can build cadences, email templates,
      • Custom Function to Format Phone / Mobile numbers in Australian Standard format

        So I got sick of phone numbers being formatted incorrectly and Zoho not doing anything to standardise phone numbers to meet E.164 formats. So I went and coded my own function to fix this. And figured I'd share with the community This is specifically for
      • Kaizen #173: A Comparison of Zoho CRM REST APIs and GraphQL APIs

        Hello everyone! Welcome back to another week of Kaizen! Zoho CRM offers two API architectures for its users: REST API and GraphQL API. Each of these API architectures has its own strengths and ideal use cases. In this post, we will discuss the difference
      • Marketer's Space: Leveraging CRM Data for Dynamic Content and Personalized Campaigns

        Hello Marketers! Welcome back to another post in Marketer’s Space! We’re excited to continue our series on the many advantages of integrating Zoho CRM with Zoho Marketing Automation (ZMA). This series is designed to help you unlock the full potential
      • How to preview a locked note? Or just lock one?

        Once a note is locked there is no preview, just a blur (good). But, if there are a lot of notes, wouldn't it be good to have the title show up and blur the rest? Or am I just being dumb - do they all unlock and lock at the same time?
      • Linkedin Plugin

        H, Is there a plugin to allow the connection to LinkedIn and simplify editing? I've looked at a few, but they all seem to be outdated and not working... What do you use or can you recommend?
      • Query About Updating Records in Batches via API

        We are working on integrating the Creator application with an external app, and we need to update thousands of records daily. I understand that the "Update Records" API is available; however, it appears to be designed for updating multiple records with
      • Unable to use Sign "You have entereed some invalid characters"

        Unable to use Sign "You have entered some invalid characters" I do not see any invalid characters. The text in "Leave a Note" is plain text which I entered directly into the field. See attached screenshot
      • Remove the link between app admin roles and org admin privileges

        Greetings Zoho One Team, Currently, assigning someone as an admin in certain Zoho apps, such as Cliq, Connect, Mail, Vault, or Forms (and maybe other apps as well) automatically grants them org admin privileges, even though they are not listed as org
      • !! URGENT My sent mail goes to spam

        I tested a few times and every time I send mail out it goes the recipients spam box.  Why is it marking my mail as spam? please help me ! thanks
      • Difference between Admin, Team leader/Manager, Clinets/user profile and roles in Zoho Project

        I've been wondering to find out the difference between the key feature of Admin,Manager, and client/user in Zoho Project. I am student and trying to learn about the Zoho Project. I could not find the roles and profiles difference between this 3 users
      • Missing Modules such as RFQ, Purchase request and Store room

        Hi, I wonder why zoho doesn't add Purchase requests module e.g. ( a lower level staff wants to request for provision of something) which can be approved or rejected by his/her manager. In case of approval, same request can be converted into RFQ. Secondly
      • Important updates to Zoho CRM's email deliverability

        Last modified on: Jul 24, 2024 These enhancements are released for all users across all data centers. Modified on: Oct 30, 2023 Organisations that are in the Enterprise and above editions of Zoho CRM, and have not authenticated their email-sending domains
      • Paid Support Plans with Automated Billing

        We (like many others, I'm sure) are designing or have paid support plans. Our design involves a given number of support hours in each plan. Here are my questions: 1) Are there any plans to add time-based plans in the Zoho Desk Support Plans feature? The
      • Zoho expense linked with Campaign instead of customers

        Hi, Is there a development planned for linked an expense or a report to a zoho campaign? Indeed, suppose I created a campain in which I add different clients (for example a trip to a foreign country where I meet 3 different clients), I would like this campaign to be linked to the expenses I have. Say I have a plane ticket, taxis and 1 hotel night, I would like those expenses to be linked to the 3 clients. With Zoho expense, it is not possible at the time (or maybe it is but I do not know how!). thanks
      • Function #4: Schedule Customer Statements

        Regularly sending statements to customers is an imperative part of many business processes as it helps foster strong customer relationships and provides timely guidance on payments. While you can generate the statement of accounts and have it sent over
      • Export multiple Invoice PDF

        As part of end of year accounting a client needs to export all of their Invoices in PDF from Zoho CRM. Do they need to click into every single Invoice and click the Export to PDF button. Is there a means of either doing a mass Export to PDF of all Invoices
      • How to create Sepa Direct Debit XML file: solution and code

        Even though Books provides a payment integration for Stripe and Gocardless (in Europe) there are customers that want to use the Sepa services of their own bank. Mainly because Stripe and Gocardless are quite expensive. In that case they would need a Sepa
      • Introducing 'Dynamic display' in the latest version of the Bigin Android mobile app.

        Hello everyone! In the latest version of the Bigin Mobile Android app (1.6.0), we have introduced support for Dynamic Display, which transforms the List View into a powerful and customizable visual interface. Dynamic Display: This feature allows users
      • CRM - Copy data from Single Line to Lookup Field

        Hello, I need help to create a workflow with a custom function in order to copy value from a single value field to a Lookup Field. Module : Shipment Single value field API name : Customer_ID Lookup field API name : Account_ID WOuld be great to have some
      • How to Parse XML Data Returned by API?

        I have several APIs integrated with my CRM and they work great. I am having some trouble though parsing data out of a large string/array in Funtions? I need to be able to pull the DeviceId and the WebSiteDeviceName from each PanelDevice. I would appreciate
      • Unable to add organization consultants and contractors in Zoho People

        Hello Team: I am unable to add my few consultants and contractors in Zoho People. How to add these people as Users?
      • Why can't I see the email from Zoho Campaigns Automation under Zoho CRM Leads module?

        I recently did update the field mapping on our Leads sync services between Zoho CRM and Zoho Campaigns. The end goal is to create tailored email drip campaigns with the use of segments and automation. I understand you can build cadences, email templates,
      • Linkedin - Recruiter System Connect

        Hi there! Does anyone here know how to connect Zoho Recruit to Linkedin Recruiter via Recruiter System Connect?
      • Lead Owner not importing all users only main user

        I have set up 3 users, 1 CEO, 2 Managers, all users have been verified. I'm using the Free ZOHO version. When I go to import Leads my Excel file has these 3 users listed as the Lead Owner. However when the import completes only 1 user is displayed as
      • Getting Data into zoho calendar from a creator app

        So how do you get a date that's created in an app, for example when a site visit is due, into the zoho calendar for the field engineers.
      • Create deal from estimate

        Hello, I have integrated CRM and books. I created an estimate on CRM but I would like to allocate that estimate to a deal with the contact. How can I do this please?
      • Lookup field, odd issue

        So I tried creating and app that has the names of engineers so I can use that for a lookup in the other apps that are being created . I add the look up in a new app, launch the app and when I try to fill out the form its just blank in the drop down menu
      • Custom module - change from autonumber to name

        I fear I know the answer to this already, but thought I'd ask the question. I created a custom module and instead of having a name as being the primary field, I changed it to an auto-number. I didn't realise that all searches would only show this reference.
      • Next Page