We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

AnirudhKumar
Mega Sage

To set value to an FX Currency field from server-side(like script include, workflow, etc.), use the below sample code:

gr.salary.setDisplayValue('EUR;1000');
gr.update();

 


To set value to an FX Currency field from client-side(like client script), use the below sample code:

g_form.setValue('salary' , 'USD;1000');

 


 

gr is the GlideRecord object to your record that you want to update

salary is the sample field name in back-end,

EUR is the sample currency(Euros)

1000 is the sample amount   

 

Note : In place of EUR, you can use USD / JPY / CHF / GBP

 

 

Long Live ServiceNow!

Comments
sam55
Tera Contributor

This works fine!! Thank you so much 🙂

Gaurav Shirsat
Mega Sage

That's Nice @AnirudhKumar 

Excellent Article.

Please Mark Correct and Helpful
Thanks and Regards
Gaurav Shirsat

saschawildg
ServiceNow Employee

DevTools is a scoped application with many helpful scripts ready to be re-used.

The built-in currency conversion API object (GlideCurrencyConverter) is a bit tricky to use.

Here you can find a nice wrapper function for currency conversion based on the ServiceNow OOTB functionality:

https://github.com/saschawildgrube/servicenow-devtools/blob/master/update/sys_script_include_6f29745...

Version history
Last update:
‎04-13-2021 03:43 AM
Updated by: