To check phone number of the leads and add '+' if it do not have in Zoho CRM
We have a workflow to send welcome message using interakt for every new lead, sometimes customer do not give the phone number with + sign or code and that leads to the failure of interakt messages.
Tried the below function to update the phone field but not sue how to trigger it or take the input leadID automatically as soon as a new lead is created in Zoho CRM. Please help.
leadId = "499201****46009";
leadRecord = zoho.crm.getRecordById("Leads",leadId);
phone = leadRecord.get("Phone");
if(!phone.startsWith("+"))
{
phone = "+" + phone;
mapToUpdate = Map();
mapToUpdate.put("Phone",phone);
updateResult = zoho.crm.updateRecord("Leads",leadId,mapToUpdate);
info updateResult;
}