Checking for - or ' in a name field

Hi @DSwanich8 ,

I think the following code could work:

exports.main = async (event, callback) => {
 // Pass firstname as a property to include in the code
 let firstname = event.inputFields['firstname'];

 // This will turn Lily-mae in Lily-Mae
 if (firstname.includes('-')) {
	const parts = firstname.split('-')
 const firstPart = parts[0]
 let secondPart = parts[1]
 secondPart = secondPart.charAt(0).toUpperCase() + secondPart.slice(1);

 firstname = firstPart + secondPart
 } 

 // This will turn O'neil into O'Neil
 if (firstname.includes("'")) {
 const parts = firstname.split("'")
 const firstPart = parts[0]
 let secondPart = parts[1]
 secondPart = secondPart.charAt(0).toUpperCase() + secondPart.slice(1);

 firstname = firstPart + secondPart
 }

 // Define firstname as an output at the bottom to be able to use the 'copy to property action and save the firstname'
 callback({
 outputFields: {
 firstname: firstname,
 }
 });
}

If you set ‘firstname’ as an output, you can use the copy to property action to store the firstname for this contact. I did not test this tho, so let me know if you run into any issues.