Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CubeYogi/9ac7defcc1b962038d33ea1027fca4c3 to your computer and use it in GitHub Desktop.
Save CubeYogi/9ac7defcc1b962038d33ea1027fca4c3 to your computer and use it in GitHub Desktop.
//Validating contact ID
if(input.contact_id != null)
{
//Getting contact entry
contact_entry = zoho.crm.getRecordById("Contacts",contact_id);
//Validating contact entry
if(!contact_entry.isEmpty())
{
contact_map = Map();
//Getting contact value
//Replace your field link name if needed
get_address = contact_entry.get("Mailing_Address");
//Validating contact address
if(get_address != null && get_address.trim() != "")
{
//formatting main address
main_address = get_address.getSuffix(" ");
//Replace your field link name if needed
contact_map.put("Main_Address", main_address);
//Updating contact entry
update_contact = zoho.crm.createRecord("Contacts", contact_map);
//Validating contact response
if(!update_contact.isEmpty() && update_contact.containKey("status") && update_contact.get("status") == "error")
{
info "Error in updating contact: "+update_contact;
}
else
{
info "Contact updated successfully";
}
}
else
{
info "Address is empty";
}
}
else
{
info "Invalid contact entry";
}
}
else
{
info "contact ID invalid";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment