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
- RelatedRecords = zoho.crm.getRelatedRecords("Deals","Accounts",acctId.toLong());
- //info RelatedRecords;
- total = 0.0;
- for each Deals in RelatedRecords
- {
- total = total + ifnull(Deals.get("Amount"),"0.0").toDecimal();
- }
- mp = Map();
- mp.put("Annual_Revenue",total);
- update = zoho.crm.updateRecord("Accounts",acctId.toLong(),mp);
- info update;