Updating a Zoho CRM Subform (Accounts) from another Module (Deals)

Updating a Zoho CRM Subform (Accounts) from another Module (Deals)

Updating a Zoho CRM Subform

This script (courtesy of Zoho) will update existing records in a subform in one module (Accounts) from another Module (Deals). To create a cross-moduel subform entry (at creation for example), please see here ...

Requirements

Identify the subform API name ( under Settings|Developer Space|APIs)

Script

deal = zoho.crm.getRecordById("Deals",dealId); //dealId is created in the script by creating the argument
accId = deal.get("Account_Name").get("id");
acc = zoho.crm.getRecordById("Accounts",accId);

subform1 = ifnull(acc.get("API_Subform_Name"),"");
info subform1.size();
if(subform1.size() > 0)
{
sub_forms = List();
for each  rec in subform1
{
oppId = ifnull(rec.get("Linked_Lookup_field_in Subform"),{"id":""}).get("id");
subform = Map();
subform.put("Linked_Lookup_field_in Subform",oppId);
if(oppId != "")
{
dealDetails = zoho.crm.getRecordById("Deals",oppId);
amount = ifnull(dealDetails.get("Your Field"),0.0);
stage = dealDetails.get("Your Field");
info amount;
subform.put("Subform_Field",amount);
subform.put("Subform_Field",stage);
}
sub_forms.add(subform);
}
info sub_forms;
parammap = Map();
parammap.put("API_Subform_Name", sub_forms);
update = zoho.crm.updateRecord("Accounts",accId,parammap);
}

    • Related Articles

    • Mass Deleting Records In Zoho CRM using the API

      Pre-requisites Using Node.js In project folder install Axios (npm install axios) In project folder, install dotenv to use .env .create .env file .env File Structure CLIENT_ID=your_client_id_here CLIENT_SECRET=your_client_secret_here ...
    • Updating Deal Field from Deal Contact Role

      To get the Your Contact Role Ids, see here Change the Ids where required. deal = zoho.crm.getRecordById("Deals", dealId); dealContactRoles = zoho.crm.getRelatedRecords("Contact_Roles", "Deals", dealId); mpRoles = map(); for each contact in ...
    • Sticky Notes in Zoho CRM

      Sticky notes in Zoho CRM are a great way to quickly jot down details about a call, a task or any other information that needs to be easily accessible. These are personal notes and not visible to other users in your CRM account. Sticky notes are ...
    • Event & Contact Sync between Office365 & Zoho CRM

      Connect your Meetings & Contacts between Zoho CRM and Microsoft Office 365.  in Office a new calender's is created called Zoho CRM, which you'll need to overlay in your Outlook. Events DO NOT sync to your personal calendar. The same applies to ...
    • Re-assigning your email address to the correct Zoho CRM instance

      Option 1: Deletes all Zoho services connected to your email address   1. Log into accounts.zoho.com (or accounts.zoho.eu depending on which server you're using) with your email address. 2. Click Preferences and select Close Account. This closes your ...