Hi,
could someone look at the code below and tell me what 's wrong with it?
After a deal creation or edition the code should find the related Account, than all open Deals for that Account and copy the field Total_Open_Deals from the Account record to all Deals at Concurrent_deals.
Total_Open_Deals is a Rollup summary field type.
- cnRecord = zoho.crm.getRecordById("Accounts",input.accID);
- relatedDeals = zoho.crm.getRelatedRecords("Deals","Accounts",input.accID);
- for each relatedDeal in relatedDeals
- {
- stage = relatedDeal.get("Stage");
- if(!stage.contains("Closed"))
- {
- updateMap = Map();
- updateMap.put("Concurrent_deals",cnRecord.getJSON("Total_Open_Deals"));
- updatedConcDeal = zoho.crm.updateRecord("Deals",relatedDeal.get("id"),updateMap);
- }
- }
Thanks.