Join us Dec. 16 for The Community Hour, our first global virtual User Group event!

How to convert the currency value "USD" to "GBP"

Rama Rao
Tera Contributor

Hello,

We have a requirement that there are two fields "Currency Dollar" and "Currency Pound". Dollar amount needs to be converted to a pound 

 

Could you please anyone help me with this?

 

Thanks in advance,

1 ACCEPTED SOLUTION

Anirudh Pathak
Giga Sage

Hi @Rama Rao ,

Here is a sample code you can try -

var conv = new sn_currency.GlideCurrencyConverter('USD', 'GBP');
conv.setAmount(100);
var convertValues = conv.convert();
gs.info('Exchanged Amount: ' + convertValues.getAmount());

 Please follow the below links, here you will find detailed explanation on how to convert currency- 

https://developer.servicenow.com/dev.do#!/reference/api/washingtondc/server/sn_currency-namespace/Gl...

 

https://developer.servicenow.com/dev.do#!/reference/api/washingtondc/server/sn_currency-namespace/Gl...

View solution in original post

7 REPLIES 7

Hi @Rama Rao ,

In line no.4 of your UI Action you have written "GPB" it should be "GBP".

Change your line no.4 of UI action to below code -

var conv = new sn_currency.GlideCurrencyConverter('USD', 'GBP');

 

Hello @Sohail Khilji,

 

Why is 'sn_currency' syntax showing some error?

 

Thanks

See this must work, update you code according to this.

 

1000097394.jpg

 try this...