Function Needed: Parse Webhook Payload Variable (Full Name to First and Last)
Hey there!
I'm working with a client who has "Full Name" fields everywhere on his site.
These are generally the best practice as it's culturally sensitive.
We need to parse data from an incoming webhook variable "Full Name" into First Name and Last Name so we can properly add people to Zoho CRM and Zoho Campaigns.
Currently I was able to make it work with 2 different functions by using this code in each and changing getSuffix to getPrefix:
list parseLastName(string nameStr)
{
return nameStr.getSuffix(" ");
}
Ideally, it's one function that can split Full Name.
Also, I need the function to say something like, "If getSuffix (last name) is empty, return "." - this is so I can add a . to the last name field in the CRM and Campaigns since it's required if the parser doesn't work for some reason.
Thanks for the help!