Created
November 12, 2020 05:13
-
-
Save CubeYogi/45254d02c170956af40b3d1bb8f5a90b to your computer and use it in GitHub Desktop.
This file contains 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
//Validating Account ID | |
if(account_id != null && account_id.trim() != "") | |
{ | |
//Getting Account entry | |
account_entry = zoho.crm.getRecordById("Accounts", account_id); | |
//Validating Account response | |
if(!account_entry.isEmpty()) | |
{ | |
//Getting Account value | |
//Replace your Accounts field API name here if needed | |
update_value = account_entry.get("Segment1"); | |
update_map = Map(); | |
//Replace your Deals field API name here if needed | |
update_map.put("Segment1", update_value); | |
//Getting Deal entries | |
deal_entries = zoho.crm.getRelatedRecords("Deals", "Accounts", account_id); | |
//Validating Deal response | |
if(!deal_entries.isEmpty() && deal_entries.size() > 0) | |
{ | |
for each deal in deal_entries | |
{ | |
//Getting Deal ID | |
deal_id = deal.get("id"); | |
//Validating Deal ID | |
if(deal_id != null) | |
{ | |
update_deal = zoho.crm.updateRecord("Deals", deal_id.toLong(), update_map); | |
//Validating Deal response | |
if(!update_deal.isEmpty() && update_deal.containKey("status") && update_deal.get("status") == "error") | |
{ | |
info "Error in updating Deal: "+update_deal; | |
} | |
else | |
{ | |
info "Deal updated successfully"; | |
} | |
} | |
else | |
{ | |
info "Deal ID is empty"; | |
} | |
} | |
} | |
else | |
{ | |
info "Invalid Deal response"; | |
} | |
} | |
else | |
{ | |
info "Invalid Account response"; | |
} | |
} | |
else | |
{ | |
info "Invalid Account ID passed"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment