Totalling from Related Records

[Zoho CRM] Totalling from Related Records

This function can be used to total a number from a related list. For example, you would like to calculate the revenue from the company based on the deals' amount.

Notes: acctId = Accounts ID

  1. RelatedRecords = zoho.crm.getRelatedRecords("Deals","Accounts",acctId.toLong());
  2. //info RelatedRecords;
  3. total = 0.0;
  4. for each  Deals in RelatedRecords
  5. {
  6. total = total + ifnull(Deals.get("Amount"),"0.0").toDecimal();
  7. }
  8. mp = Map();
  9. mp.put("Annual_Revenue",total);
  10. update = zoho.crm.updateRecord("Accounts",acctId.toLong(),mp);
  11. info update;
have any questions? Contact us here at Aplikasi!
    • Related Articles

    • [Zoho CRM] Send Email Template Using Deluge in Zoho CRM

      How to send an email using an email template in a Deluge/Custom Function/Button? This function is used to send email using Zoho CRM email templates. We would have to get the template id by going to the respective template and edit it. In the URL of ...
    • [Zoho CRM] Get Birthday Months Formula

      Create a custom formula field and make sure the return type is String. Then, write this formula: If(Month(${Contacts.Date of Birth})==1,'01',If(Month(${Contacts.Date of Birth})==2,'02',If(Month(${Contacts.Date of ...
    • [Zoho CRM] How to create a function for mass action button?

      In the function you are about to write, you can edit the Arguments. Let's say for example we're dealing with the Deals module, then what you want to do is add an argument mapping to the Deal ID field. I would suggest putting the mapping value as a ...
    • [Zoho CRM] A Comprehensive Guide for Zoho CRM Wizards

      Unleashing the Power of Zoho CRM Wizards: A Comprehensive Guide What is CRM Wizards? Zoho CRM Wizards are a powerful tool designed to simplify and enhance the data entry process in Zoho CRM. They enable users to break down lengthy forms into a series ...
    • [Zoho CRM] Importing Records

      Sometimes you need to import a lot of records at once into Zoho CRM. This is a very common phenomenon. You wouldn't want to create your records one by one, moreover if they're in the thousands! Worry not, as it is really easy to do so in Zoho CRM. ...