- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2026 06:16 AM
Good morning everyone,
i've been creating finance request forms for my firm's finance department and have a request that i am not sure how to proceed in developing.
Currently, when someone purchases an item in another currency we want to see the currency they used. the price in that currency and then the amount converted to CAD.
Which they will be paid out in CAD
The user would then first put in the amount converted which in this case is 125.25
By default the currnecy used is CAD but if they purchase in another they will choose and then the thrid field will show the USD> 100.01 which they put in themselves
My question, is there a simpler way to do this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2026 07:09 AM
Hi Peter,
The current process feels "backwards" for the end-user because it asks for the result (CAD) before the input (Original Amount).
The "Simpler Way" (Better UX): Flip the logic. Ask the user for the Original Amount and Currency first, then let ServiceNow automatically calculate the estimated CAD amount for them.
Note: Since credit card exchange rates differ from system rates (due to bank fees), you should always leave the final "CAD Amount" field editable so the user can match it exactly to their bank statement.
Here is the setup to automate this:
1. Create/Arrange your Variables
original_currency (Select Box/Lookup Select Box pointing to fx_currency or just static choices like USD, EUR).
original_amount (Decimal or Single Line Text).
reimbursement_amount_cad (Decimal) -> This will be auto-populated.
2. The Backend Logic (Script Include) Create a Client Callable Script Include to fetch the system exchange rate.
Name: CatalogCurrencyHelper
Client Callable: Checked
var CatalogCurrencyHelper = Class.create(); CatalogCurrencyHelper.prototype = Object.extendsObject(AbstractAjaxProcessor, { convertCurrency: function() { var amount = this.getParameter('sysparm_amount'); var fromCurr = this.getParameter('sysparm_currency'); var toCurr = 'CAD'; // Target currency if (!amount || !fromCurr) return ''; // Use the native Currency Converter API var converter = new sn_currency.GlideCurrencyConverter(fromCurr, toCurr); converter.setAmount(amount); var result = converter.convert(); return result.getAmount(); // Returns the converted value }, type: 'CatalogCurrencyHelper' });
3. The Frontend Logic (Catalog Client Script) Create an onChange script that triggers when the Currency or Original Amount changes.
Type: onChange
Variable: original_amount (Create a similar one for original_currency)
function onChange(control, oldValue, newValue, isLoading) { if (isLoading || newValue == '') { return; } var currency = g_form.getValue('original_currency'); // e.g., 'USD' if (!currency || currency == 'CAD') return; var ga = new GlideAjax('CatalogCurrencyHelper'); ga.addParam('sysparm_name', 'convertCurrency'); ga.addParam('sysparm_amount', newValue); ga.addParam('sysparm_currency', currency); ga.getXMLAnswer(function(response) { if (response) { // Set the estimated CAD amount // You might want to round it: parseFloat(response).toFixed(2) g_form.setValue('reimbursement_amount_cad', response); g_form.showFieldMsg('reimbursement_amount_cad', 'Estimated based on today\'s rate. Please adjust to match your bank statement if needed.', 'info'); } }); }
Result: The user types 100 and selects USD. The system instantly populates 135.50 in the CAD box. The user smiles because they didn't have to do the math.
If this response helps you, please mark it as Accepted Solution.
This helps the community grow and assists others in finding valid answers faster.
Best regards,
Brandão.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2026 10:36 AM
Hi Peter,
That screenshot is the "Smoking Gun"! The logs confirm that the Script is working perfectly, but your Data is missing.
The Analysis:
Code is Good: Look at the line Interpreted Date Object=2025-10-28. The system is successfully receiving and understanding the date you selected.
The Issue: Look at the Result for the different dates.
Date 2025-10-28 -> Result: 138.2589
Date 2026-01-20 -> Result: 138.2589
Date 2026-01-02 -> Result: 138.2588... (Effectively the same).
Conclusion: The conversion result isn't changing because your instance does not have historical Exchange Rates loaded for those specific dates in the past. When ServiceNow cannot find a rate for "Jan 2nd, 2026" in the fx_rate table, it falls back to the most recent available rate (likely today's rate).
Next Step: You can mark the script as "Done". To fix the calculation values, you need to check your data:
Navigate to the fx_rate table.
Filter for Currency = USD.
You will likely see only one or two recent records.
For this to work historically, you would need to import historical rate data (or just wait, as the daily Scheduled Job builds up the history from now on).
Best regards,
Brandão.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2026 06:31 AM
Hi,
you can take the help from this video
I have used the similar steps in my scenario.
Thanks,
Gargi
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2026 07:06 AM
thank you i have already saw this video but its not the same as what i am trying to do.
This is for an MRV where users have expenses they are submitting for Reimbursement but they purchase various items in different currencys
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2026 07:09 AM
Hi Peter,
The current process feels "backwards" for the end-user because it asks for the result (CAD) before the input (Original Amount).
The "Simpler Way" (Better UX): Flip the logic. Ask the user for the Original Amount and Currency first, then let ServiceNow automatically calculate the estimated CAD amount for them.
Note: Since credit card exchange rates differ from system rates (due to bank fees), you should always leave the final "CAD Amount" field editable so the user can match it exactly to their bank statement.
Here is the setup to automate this:
1. Create/Arrange your Variables
original_currency (Select Box/Lookup Select Box pointing to fx_currency or just static choices like USD, EUR).
original_amount (Decimal or Single Line Text).
reimbursement_amount_cad (Decimal) -> This will be auto-populated.
2. The Backend Logic (Script Include) Create a Client Callable Script Include to fetch the system exchange rate.
Name: CatalogCurrencyHelper
Client Callable: Checked
var CatalogCurrencyHelper = Class.create(); CatalogCurrencyHelper.prototype = Object.extendsObject(AbstractAjaxProcessor, { convertCurrency: function() { var amount = this.getParameter('sysparm_amount'); var fromCurr = this.getParameter('sysparm_currency'); var toCurr = 'CAD'; // Target currency if (!amount || !fromCurr) return ''; // Use the native Currency Converter API var converter = new sn_currency.GlideCurrencyConverter(fromCurr, toCurr); converter.setAmount(amount); var result = converter.convert(); return result.getAmount(); // Returns the converted value }, type: 'CatalogCurrencyHelper' });
3. The Frontend Logic (Catalog Client Script) Create an onChange script that triggers when the Currency or Original Amount changes.
Type: onChange
Variable: original_amount (Create a similar one for original_currency)
function onChange(control, oldValue, newValue, isLoading) { if (isLoading || newValue == '') { return; } var currency = g_form.getValue('original_currency'); // e.g., 'USD' if (!currency || currency == 'CAD') return; var ga = new GlideAjax('CatalogCurrencyHelper'); ga.addParam('sysparm_name', 'convertCurrency'); ga.addParam('sysparm_amount', newValue); ga.addParam('sysparm_currency', currency); ga.getXMLAnswer(function(response) { if (response) { // Set the estimated CAD amount // You might want to round it: parseFloat(response).toFixed(2) g_form.setValue('reimbursement_amount_cad', response); g_form.showFieldMsg('reimbursement_amount_cad', 'Estimated based on today\'s rate. Please adjust to match your bank statement if needed.', 'info'); } }); }
Result: The user types 100 and selects USD. The system instantly populates 135.50 in the CAD box. The user smiles because they didn't have to do the math.
If this response helps you, please mark it as Accepted Solution.
This helps the community grow and assists others in finding valid answers faster.
Best regards,
Brandão.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2026 07:32 AM
Wow this is amazing i have implemented this and works beautifully.
i dont know what i can say but thank you very much for this
