Currency Format in Email

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?

Unfortunately, one of the limitations of automations is that the actions don’t recognize formatting from the fields.

This affects date & time fields, number fields, currency fields, rich text fields — even checkbox & rating fields.

So you would need to create a separate formula field to reformat your currency field all over again into how you would like it to look.

Yes, this is redundant. I’m hoping that Airtable addresses this limitation soon. Although I should mention that this limitation affects the API too. So, across the board, field formatting really isn’t recognized outside of the fields themselves.

In the meantime, this thread explains how to reformat your currency field with a formula:

2 Likes

Unfortunately, there’s currently no easy way to do this. I have a ridiculously long and involved formula that I use (I will share it when I get to my computer later today).

Another option would be to use the scripting block - I have a function that will convert a number to a currency display value that I can share as well :slight_smile:

Last option - use Zapier to send the email instead of airtable. They have a formatting step that works well :slight_smile:

2 Likes

Also, as @Neads_Admin mentioned, Zapier has a formatting option that you can turn to. And if you prefer Integromat, they also have a “formatNumber” function:

1 Like

Thanks, @Neads_Admin - 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.

Thanks, @ScottWorld - I will take a look at your thread on reformatting. I appreciate your help!

1 Like

This should do the trick :slight_smile: 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 :slight_smile:

Hope this helps!

4 Likes

@Neads_Admin - I will give this a try! Thank you!

And … @Neads_Admin for the WIN! This worked perfectly (and was my first script too!). Much appreciated!!

1 Like

Yay!! Happy to help :slight_smile:

Congrats on your first script as well - keep going! :innocent:

1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.