How to make Currency Code Read only??

Mohammed8
Tera Sage

In Workspace, I have field with type Currency. I want to make this currency code as read-only.

Any idea how to achieve this ?

@Ankur Bawiskar , @Dr Atul G- LNG , @glideFather 

 

Mohammed8_0-1786019824026.png

 

 

4 REPLIES 4

Dr Atul G- LNG
Tera Patron

Hi @Mohammed8 

 

https://www.servicenow.com/community/sam-articles/mastering-currency-settings-in-servicenow-enable-d...

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG

****************************************************************************************************************

Ankur Bawiskar
Tera Patron

@Mohammed8 

on form you don't want user to change the currency?

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

@Mohammed8 

I don't think this is possible

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Abhishek Pal
Mega Guru

Hi @Mohammed8 ,

In Configurable Workspace, a Currency field is rendered as one composite control containing both the amount and currency code.

There is no supported OOB GlideForm, UI Policy, or dictionary configuration to make only the currency-code dropdown read-only while keeping the amount editable.

Using:

g_form.setReadOnly('u_amount', true);

will make the complete Currency field read-only.

Recommended options:

1. If the entire instance must use CHF

Enable single-currency mode:

glide.i18n.single_currency = true
glide.i18n.single_currency.code = CHF

In single-currency mode, the currency appears as a non-editable label.

Important: This setting is instance-wide and affects all currency fields, so do not use it for only one table or field.

2. If only this specific field must use CHF

The cleanest design is:

- Use a Decimal field for the editable amount.
- Use a separate Currency Code field defaulted to CHF.
- Make the Currency Code field read-only.
- Enforce CHF through server-side validation.

3. If you must retain the Currency field

Set its default value to CHF and add a Before Business Rule to prevent users or integrations from saving another currency.

Example:

(function executeRule(current, previous) {

if (current.u_amount.nil())
return;

if (current.u_amount.getCurrencyCode() != 'CHF') {
current.u_amount.setError(
'Only CHF is allowed for this field.'
);

current.setAbortAction(true);
}

})(current, previous);

Replace u_amount with the actual Currency field name.

This protects the data, although the currency dropdown will still remain visible in Workspace.

I would not recommend:

- DOM manipulation
- Disabling the dropdown using querySelector()
- Accessing an internal field such as u_amount.currency_type
- Modifying the OOB Workspace currency component
- Removing currencies from the fx_currency table

Those approaches are unsupported or upgrade-sensitive.

Therefore, for a single field, the best supported solution is a Decimal amount field plus a separate read-only Currency Code field. Use single-currency mode only when CHF must apply across the entire instance.

References:

https://www.servicenow.com/docs/r/platform-administration/currency-administration/single-currency-mo...

https://www.servicenow.com/docs/r/platform-administration/currency-administration/currency-values-sc...

Hope this helps!

If this response helped, please mark it as Helpful.
If it resolves your issue, please Accept it as Solution.

Kind Regards,
Abhishek Pal