Desk Contact Name > split to First and Last name
I am new to Zoho and while setting up the Desk and Help Center, I saw that new tickets created or submitted from the Help Center used the Contact Name field. This would create a new Contact but put the person's name in the Last Name field only. The First Name field would be blank.
Upon asking for help from the Zoho team, here is their Custom Function solution:
- Navigate to Setup > Automation > Workflows
- Create Rule
- Execute on > Create (check this box)
- Criteria > First Name | is empty
- Actions > Custom Function
- Name = split_name
- Module = Contacts
- Argument Mapping (see attached screenshot for reference)
- Name = Lname, Value = Contacts.Last Name
- Name = Id, Value = Contacts.recordid
- SAVE
- Navigate to Setup > Developer Space > Functions
- Create a New Function
- Name = split_name
- Category = Automation
- Module = Contacts
- Write the Deluge code below, using your own Organization ID (see attached screenshot for reference):
- Save
orgid = xxxx;
if(lname.contains(" "))
{
zoho.desk.update(orgid,"contacts",id,{"lastName":lname.getSuffix(" "),"firstName":lname.getPrefix(" ")});
}
That should be it.
I hope this helps others who run into the same problem.