Service catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Community! In the service portal, there is a field "approver" which is a reference field and I wanted to make it read only. Since the field is not a variable set, it is a custom field inside a custom Service Portal cart widget. Catalog UI policy/client script will not work. How to make the field read only? Detailed answer would be highly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
If it's a field, treat it like any other field. Since it's a custom field you'll have to find the table it's on, then you can make it read only at the dictionary level, or with a table-level UI Policy or Client Script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
To make an approver reference field read-only in a custom Service Portal cart widget, the most effective method in ServiceNow is to use AngularJS directives within the HTML template or manipulate the field via the Client Controller.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @ShaibaazFaheem ,
Because the field is in a custom Service Portal widget, make it read‑only in the widget itself:
- Add
ng-disabled="true"(for reference pickers)
or - Add
ng-readonly="true"(for input fields)
This makes the field read‑only in the portal.
Most custom portal widgets use sn-record-picker for reference selection.
Example (HTML):
<sn-record-picker
field="c.approverField"
table="'sys_user'"
display-field="'name'"
value-field="'sys_id'"
ng-model="c.data.approver"
ng-disabled="true">
</sn-record-picker>Conditionally read-only (e.g., based on state/role)
<sn-record-picker
field="c.approverField"
table="'sys_user'"
display-field="'name'"
value-field="'sys_id'"
ng-model="c.data.approver"
ng-disabled="c.isReadOnly">
</sn-record-picker>c.isReadOnly = true; // or condition
// e.g. c.isReadOnly = (c.data.ritm_state == 'approved' || !c.data.canEdit);Catalog UI Policies / Client Scripts won’t work here.
For full safety, block updates using an ACL or Business Rule.
Create a write ACL on the field (or table) to deny updating the approver field.
- Table: your table (ex:
sc_cart_item/sc_req_item/ your custom table) - Field:
u_approver(your custom field) - Operation: write
- Script condition: allow only specific roles OR deny always if required.
answer = gs.hasRole('admin');
Thanks,
Rithika.ch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
screenshots please
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
