From 1c8a59027160e958468879cb5c3aa817ffb57d88 Mon Sep 17 00:00:00 2001 From: AnveshKumar Mupparaju Date: Wed, 1 Oct 2025 07:32:37 +0530 Subject: [PATCH] Set price field to accept a single currency --- .../README.md | 13 +++++++++++++ .../price_field_restriction_to_one_currency.js | 10 ++++++++++ 2 files changed, 23 insertions(+) create mode 100644 Client-Side Components/Client Scripts/Price field restriction to one currency/README.md create mode 100644 Client-Side Components/Client Scripts/Price field restriction to one currency/price_field_restriction_to_one_currency.js diff --git a/Client-Side Components/Client Scripts/Price field restriction to one currency/README.md b/Client-Side Components/Client Scripts/Price field restriction to one currency/README.md new file mode 100644 index 0000000000..725a1c8801 --- /dev/null +++ b/Client-Side Components/Client Scripts/Price field restriction to one currency/README.md @@ -0,0 +1,13 @@ + +# Client Script - Set Price type field to only one currency + +In a multi currecny enabled servicenow environment, if you have a requirement to enable only one currency choice for a particular table and field of type Price. + +## Usage + +- Create a new client script +- Set the type to OnLoad. +- Copy the script to your client script. +- Update the in the client script to 'Your field name' +- Add your currency code and symbol in place of USD & $ +- Save \ No newline at end of file diff --git a/Client-Side Components/Client Scripts/Price field restriction to one currency/price_field_restriction_to_one_currency.js b/Client-Side Components/Client Scripts/Price field restriction to one currency/price_field_restriction_to_one_currency.js new file mode 100644 index 0000000000..c2fed5261f --- /dev/null +++ b/Client-Side Components/Client Scripts/Price field restriction to one currency/price_field_restriction_to_one_currency.js @@ -0,0 +1,10 @@ +function onLoad(){ + // Remove all currency options + g_form.clearOptions('.currency_type'); + + // Add only one currency option (e.g., USD) + g_form.addOption('.currency_type', 'USD', '$'); + + // Set the currency field to the only available option + g_form.setValue('.currency_type', 'USD'); +} \ No newline at end of file