I would like to create currency field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2022 10:08 PM
Hello,
I would like to set this field to be currency format automatically.
It means if I enter '10000', it will auto convert to 10,000.00. If I enter '1000000', it will auto convert to '1,000,000.00'. This field will not allow user to manually type comma , and it could support 2 decimal.
The value cannot be exceed than 999,999,999.99.
Could anyone help?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2022 10:21 PM
On Submit()-- Catalog script
var s = g_form.getValue("field_name"); // getting field name
var float1 = parseFloat(s). toFixed(2);// Two digits
g_form.setValue("field_name",float1); // Setting the formatted value
if(float1 >= your value)
{
return false; // Abort if value if greater
}
Mark correct and helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2022 11:25 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2022 11:14 PM
Hi there,
Not sure if it suits your requirement, though maybe you can use a Variable of type "Custom" and selecting Widget "Variable Currency".
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP
---
LinkedIn
Community article, blog, video list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2022 11:23 PM