How to make Currency Code Read only??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @Mohammed8
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
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
on form you don't want user to change the currency?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
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! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
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:
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