Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

How to use Intl.NumberFormat in business rule?

Lucas11
Tera Contributor

Captura de Tela 2023-01-16 às 11.59.40.png

Captura de Tela 2023-01-16 às 11.59.59.png

1 REPLY 1

Gunjan Kiratkar
Kilo Patron

Hi @Lucas11 ,

Below is the sample test script for Intl.NumberFormat

// Get the number you want to format
var number = current.amount;

// Create a new Intl.NumberFormat object for currency formatting
var formatter = new Intl.NumberFormat('en-US', {
  style: 'currency',
  currency: 'USD',
});

// Format the number as a currency
var formattedNumber = formatter.format(number);

// Update the field with the formatted number
current.amount = formattedNumber;

Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy