Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CubeYogi/924f40a5e5820923283d268254592b16 to your computer and use it in GitHub Desktop.
Save CubeYogi/924f40a5e5820923283d268254592b16 to your computer and use it in GitHub Desktop.
//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