Skip to main content
Best answer

Is it possible to use the Formatter to pull the first letter of each word from an input?

  • August 19, 2024
  • 3 replies
  • 169 views

Hello! 

Thinking about proposing something new, but would like to see if it’s possible first. We work in a competitive industry and have had a problem with a low level employee trying to sell a customer list they obtained from order forms. I think we can help prevent this in the future by using the first letter of each word of the customer’s name as the identifying field instead of using the customer’s full name. 

The orders are entered on Quickbooks, and are sent to their respective workflows in Zapier. Would it be possible to change an order name from: Albert Berns Company:1234 to: ABC:123 using the formatter? If so, how? I’ve experimented with the idea, but haven’t had any success. 

Thank you so much! 

Best answer by Troy Tessalone

Hi @KBS 

That would likely involve using a custom Code step.

https://zapier.com/apps/code/help

 

let Name = inputData.Name;
let Abbreviation = getFirstLetters(Name);

function getFirstLetters(text) {
return text.split(' ') // Split the string into an array of words
.map(word => word[0]) // Map each word to its first letter
.join(''); // Join all the first letters together
}

output = [{Abbreviation, Name}];

 

 

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • Answer
  • August 19, 2024

Hi @KBS 

That would likely involve using a custom Code step.

https://zapier.com/apps/code/help

 

let Name = inputData.Name;
let Abbreviation = getFirstLetters(Name);

function getFirstLetters(text) {
return text.split(' ') // Split the string into an array of words
.map(word => word[0]) // Map each word to its first letter
.join(''); // Join all the first letters together
}

output = [{Abbreviation, Name}];

 

 


  • Author
  • New
  • August 19, 2024

This worked great! Thank you so much! 


SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • August 21, 2024

YAY! 🎉 Thanks so much for following up here @KBS, to confirm that Troy’s suggestion did the trick. And shout out to Troy for helping out! 🙌

Please do reach out to the Community again if you’re ever in need of assistance in future. Until then, happy Zapping! ⚡