Created
May 31, 2015 06:58
-
-
Save jeznag/7e12bf5c68a36ad44fbd to your computer and use it in GitHub Desktop.
Update amount for Zoho CRM potential based on related products
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
potential_obj = zoho.crm.getRecordById("Potentials", potential_id); | |
related_products = zoho.crm.getRelatedRecords("Products", "Potentials", potential_id.toString(), 1,200); | |
total_amount = 0.0; | |
for each product in related_products { | |
total_amount = total_amount + product.get("Unit Price").toDecimal(); | |
} | |
potential_obj.put("Amount", total_amount); | |
potential_obj.put("Populate amount based on products associated", false); | |
update_resp = zoho.crm.updateRecord("Potentials", potential_id.toString(), potential_obj); | |
info("Response: " + update_resp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment