- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 01:03 AM
Hi,
I am trying to set currency value to 1 with g_form.setValue("field", "1");
When this client script runs it puts the value 1,00 to the field and after I save the record the value changes to 100.00
I have also tried with GlideAjax but same result. Any ideas?
Thanks
.: Ilkka
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 05:03 AM
I found the reason for this behaviour and tried it within my own dev instance. It is because this instance has glide.system.locale value of en.FI and it is actually not supported. the locale should be fi.FI
here is the docs site about system locale
and here is the list of supported locale values
http://www.oracle.com/technetwork/java/javase/javase7locales-334809.html
Kind of bad situation because the customer I am working on has the same value in production instance as well, and now I am not sure if it is wise to change it. The docs point out that it should not be changed after the instance is in production.
.: Ilkka

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 01:13 AM
Hi,
Try using below snippet in the client script.
var currencyis = '1';
alert('Currency is '+currency is);
var parsedcurrencyis = parseInt(currencyis);
alert(parsedcurrencyis);
g_form.setValue('u_currency', parsedcurrencyis); //considering u_currency is the currency field
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 01:23 AM
Hi Jaspal,
I received an error and obviously, you need to pass a string with g_form.setValue when dealing with currency fields
https://hi.service-now.com/kb_view.do?sysparm_article=KB0691933
I tried your code and added toString() into the g_form.setValue but still see the same result. The first value is 1,00 (here separator is a comma) and after save it changes to 100.00 (separator is dot)
.: Ilkka

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 01:36 AM
what input have you mentioned in your client script? is it 1 , and once it set it ,it's appearing as 1,00 ?
can you tell me what output are you expecting ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 01:49 AM
Hi Harshvardhan,
I have it like this g_form.setValue("field", "1");
when the client script has run the field has value 1,00 and this would be fine, but after I save the record the value is 100.00 for some reason. so from 1 to 100, not great. Looks like ServiceNow interprets the comma to thousand separator and not as a decimal point
.: Ilkka