Currency validation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2017 05:53 AM
HI,
Can anyone please suggest the validation for 00,000,000,000.00 on the client script
Thanks in advance,
Niharika
- Labels:
-
Enterprise Asset Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2017 05:57 AM
Hi Niharika,
What is your exact requirement?
What validation you want to do and against what?
Can you explain in detail.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2017 06:29 AM
Hi Ankur ,
we have a string type variable on catalog item where we want currency validation.The format should be like 00,000,000.00 .
When the user enters the amount in the wrong format ,there should be an alert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2017 06:34 AM
Hi Niharika,
you will have to use regular expression for this
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2017 07:31 AM
Hi Niharika,
Following is the code which contains the Regular Expression. It matches strings such as 00,000,000,000.00 i.e. 2 digits,3digits,3digits,3digits then dot and 2 zeros
var costcenter = "01,000,123,133.00";
var validate1 = new RegExp('[0-9]{2},[0-9]{3},[0-9]{3},[0-9]{3}.00$');
var result = validate1.test(costcenter);
gs.print(result);
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader