- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2020 12:35 AM
Hi everyone,
There are two currency fields. The first of them is Original Cost and the second one is Converted Cost. I want to copy the value of the first currency field, and then I want to paste the value to the second currency field. The value of the first currency field will be passed to the second currency field. I can pass the amount but I cannot change the currency code. In the Orlando release, there are several APIs for currency, but I could not them effectively. How can I set the currency code of the Converted Cost field as the Original Cost? I want to indicate that, when I update the form, the currency code of the Converted Cost field becomes "$" for a short period initially. Then it returns to again "₺".
Besides, I used these two fields for test. If I success to pass amount and currency code from original cost field to converted cost field, I will use these script in the Opportunities module.
Thank you in advance
Have a nice day 🙂
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2020 12:45 AM
Hi,
you will have to convert USD to your another currency
after you get the converted value you need to set it like this
var currencyCode = 'EUR';
current.u_c_c.setValue(currencyCode + ";" + convertedValue);
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
09-17-2020 12:45 AM
Hi,
you will have to convert USD to your another currency
after you get the converted value you need to set it like this
var currencyCode = 'EUR';
current.u_c_c.setValue(currencyCode + ";" + convertedValue);
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
09-17-2020 12:59 AM
Thank you Sir Ankur,
It works properly. You are the legend 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2020 12:46 AM
Hi,
you can set the currency like this.
current.setValue("your_field",'USD;10'); //separator is ;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2020 01:04 AM
Hi Asifnoor,
I tried your script with a small modification and it worked. Thank you 🙂
var a='USD;'+amount;
current.setValue("u_c_c",a);