Function Needed: Parse Webhook Payload Variable (Full Name to First and Last)

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!

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now