Created
November 25, 2020 07:39
-
-
Save CubeYogi/924f40a5e5820923283d268254592b16 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 Custom Module ID | |
if(custom_module_id != null) | |
{ | |
//Getting Custom Module entry | |
custom_entry = zoho.crm.getRecordById("Benchmarks", custom_module_id); | |
//Validating Custom Module entry | |
if(!custom_entry.isEmpty() && custom_entry.containKey("Opportunity")) | |
{ | |
//Getting Deal entry | |
deal_map = custom_entry.get("Opportunity"); | |
//Validating Deal map | |
if(!deal_map.isEmpty()) | |
{ | |
//Getting Deal ID | |
deal_id = deal_map.get("id"); | |
//Validating Deal ID | |
if(deal_id != null && deal_id.trim() != "") | |
{ | |
//Validating Contact map | |
contact_map = custom_entry.get("Contact"); | |
//Validating Contact map | |
if(!contact_map.isEmpty()) | |
{ | |
//Getting Contact ID | |
contact_id = contact_map.get("id"); | |
//Validating Contact ID | |
if(contact_id != null && contact_id.trim() != "") | |
{ | |
update_map = Map(); | |
contact_map = Map(); | |
contact_map.put("id", contact_id); | |
//Updating Deal Contact | |
update_map.put("Contact", contact_map); | |
//Updating Deal stage | |
update_map.put("Stage", "Value Proposition"); | |
//Updating Deal | |
update_deal = zoho.crm.updateRecord("Deals", deal_id, 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 "Contact ID is empty"; | |
} | |
} | |
else | |
{ | |
info "Contact not associated"; | |
} | |
} | |
else | |
{ | |
info "Deal ID is empty"; | |
} | |
} | |
else | |
{ | |
info "Deal not associated"; | |
} | |
} | |
else | |
{ | |
info "Custom entry is invalid"; | |
} | |
} | |
else | |
{ | |
info "Custom entry ID invalid"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment