I have a field defined as Currency however when I add that field to the Message section of an email that I am creating from an Automation, the value does not appear as Currency. It does have the decimal point for the cents, and I can easily add “$” as part of the preceding text, but I would really like to see the commas that are part of the defined format on the field. Any ideas?

Currency Format in Email
Best answer by AlliAlosa
Thanks, @AlliAlosa - I would be interested to see your scripting block. As for Zapier, I’m currently using a Zap to send this notification. Now that we have Automations, I am trying to replace as many Zaps as I can with Automations. So keeping this one in Zapier is certainly an option.
This should do the trick :slightly_smiling_face: Add a “Run a script” step to your automation, before the “Send Email” step.
In the side bar on the left, add an input variable called currency and choose your {Currency} field.
Use this code for the script:
let inputValues = input.config();
let currency = inputValues.currency;
//define function to convert numbers to currencies for report display
function toCurrency(rawValue) {
return "$ " + (Number(rawValue)).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
}
output.set("amount", toCurrency(currency));
This should output a formatted value for you to use in your email step :slightly_smiling_face:

Hope this helps!
Login to the community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
