currency and number formatter

een
Kilo Contributor

How do I format a currency field so that it displays 01000000 as $1,000,000.00

my code to display currently is

snipping-tool-code-sample.PNG

where cost is defined as a variable

I've looked at the server side script API and do not seem to be able to locate anything.

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Ian,



Replace line 15


as cost = equipment.cost. getCurrencyDisplayValue(); and you can remove line 16


View solution in original post

14 REPLIES 14

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Ian,



Replace line 15


as cost = equipment.cost. getCurrencyDisplayValue(); and you can remove line 16


More info under section 2 in the wiki link I have shared above


een
Kilo Contributor

Thanks guys both your responses have answered my question. I found that I had to initialize the cost too an empty string instead of zero as the zero was being prepended to the value being displayed. Thanks for your help guys!!!



snipping-tool-code-sample.PNG


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Thanks Ian for the update.


Can you please mark one of our response as correct and close the loop if this answers your question.


een
Kilo Contributor

I am not sure how I mark a response as correct. The only options that are available to me is to either 'like' a response or indicate that a response is 'helpful' or 'not helpful'. When i click on Actions there is no actions to select. Once again I am new to using the community forum so any help would be greatly appreciated.