Ever wanted to split a full name into first name and last name?
JavaScript code to the rescue!
Now you can predictably map the output variables in your Zap steps.
NOTE: This will not work 100% due to the following potential conditions…
- Multiple First Names
- Multiple Last Names
- Middle Name(s)
- Name Prefix (e.g. Dr.)
- Name Suffix (e.g. Jr.)
How to Configure

Copy the Code
let NameFull = inputData.NameFull.trim().split(' '); // removes whitespace and splits by spaces
let NameFirst = NameFull[0]; // takes first array item
let NameLast = NameFull[NameFull.length - 1]; // takes last array item
output = [{NameFirst, NameLast, NameFull}];
The Results
