I want to add a comma to the decimal item and display it in the body of the email.

Miyoshi
Tera Contributor

I want to add a comma to the Decimal type amount in a server-side script (EmailScript) and display it in the body of the email.
<Example: Amount: 5000 ⇒ 5,000>

As shown below, I have described a script that adds commas to Decimal type amounts, but commas are not added.

I want you to tell me the solution.

find_real_file.png

1 ACCEPTED SOLUTION

Anil Lande
Kilo Patron

Hi,

Please check below link, you can find different solutions proposed for this type of conversion.:

https://community.servicenow.com/community?id=community_question&sys_id=4785c9711b4a4050a59033f2cd4b...

 

https://www.hashbangcode.com/article/format-numbers-commas-javascript

 

Thanks,
Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

View solution in original post

4 REPLIES 4

Anil Lande
Kilo Patron

Hi,

Please check below link, you can find different solutions proposed for this type of conversion.:

https://community.servicenow.com/community?id=community_question&sys_id=4785c9711b4a4050a59033f2cd4b...

 

https://www.hashbangcode.com/article/format-numbers-commas-javascript

 

Thanks,
Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Hello, Anil Lande.

Thank you for presenting the solution. Let's verify whether the amount of money can be added with a comma by the measures you received.

Hello, Anil Lande.

 

By the method you taught me, I can now display the amount with a comma.

Thank you very much!

Miyoshi
Tera Contributor

I would like someone to tell me more.

In server-side script (EmailScript), the following method to put a comma in the amount was not available, but it can be used in Client script.
What is the difference between the two?

<Method with comma>
toLocaleString (undefined, {
maximumFractionDigits: 20
})

find_real_file.png