Enable 'Preview Record' icon on single catalog variable

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2024 09:37 AM
I have a read-only reference field variable on a catalog item that is populated via catalog client script by entering an employee number.
After the catalog item is submitted, I want to be able to preview the "Employee to review" on the RITM and SCTASK. I have tried setting the attribute on that variable to "readonly_clickthrough=true" but that doesn't work. To be thorough, I set the variable attributes to "ref_decoration_disabled=false, readonly_clickthrough=true" which also didn't work. According to the documentation for variable attributes linked on the form, it doesn't appear either attribute is valid on catalog variables, maybe?
The only thing I was able to find that would work was setting the property "glide.ui.reference.readonly.clickthough" to True. Problem is, that is system-wide and I really only want it on this one variable.
Any ideas how I can make this work?
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2024 09:14 PM
Hi @tsutherland
To make a read-only reference field variable on a catalog item preview on the RITM and SCTASK, you can follow these steps:
Set the variable attributes: Unfortunately, setting the attribute readonly_clickthrough=true or ref_decoration_disabled=false, readonly_clickthrough=true on the variable does not work for previewing the reference field on RITM and SCTASK.
Use catalog UI policy: You can use a catalog UI policy to make the variable read-only on the RITM and SCTASK forms. Here's how you can do it:
- Go to the catalog item form.
- Scroll down to the "Variables" related list.
- Click on the "UI Policies" related list.
- Click on "New" to create a new UI policy.
- Set the "UI Type" to "Catalog Item".
- Set the "UI Policy Action" to "Read Only".
- In the "Conditions" section, add a condition to target the specific variable you want to make read-only.
- Save the UI policy.
This will make the variable read-only on the RITM and SCTASK forms.
Set the property "glide.ui.reference.readonly.clickthrough": If you want to make the reference field read-only only for this specific variable, you can set the property "glide.ui.reference.readonly.clickthrough" to "true". However, this property is system-wide and will affect all reference fields. If you want to make the change only for this variable, you can set the property temporarily and revert it back after the desired preview is achieved.
Please note that the above steps are based on the ServiceNow documentation and community discussions. It's always recommended to test these changes in a non-production environment before implementing them in a production instance.
References:
- ServiceNow Community: RITM & Catalog Task Variables Read Only
- ServiceNow Community: All the variables are read only in RITM and task table
- ServiceNow Community: To make all the field read only in RITM and TASK form
- ServiceNow Community: Make the (RITM)catalog Task variables Read Only
- ServiceNow Community: How to make RITM and SCTASK variable fields read only after RITM
Please Mark this as Helpful/Accepted if this solves your query.
Thanks& Regards
Deepak Sharma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2024 01:51 PM
I opened a support ticket on this and here is the response:
Looked into this further and reviewed with some SMEs on my team. Unfortunately, we don't currently have an individual attribute for this, only that "glide.ui.reference.readonly.clickthough" that you had found which as mentioned would affect all fields instead of the specific needed ones.
They suggested I submit an enhancement request, which I did HERE.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2024 05:13 PM
there is a system property allowing that. search for *readonly.clickthrough
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2024 05:37 PM - edited ‎12-16-2024 05:40 PM
I ran into this issue a few weeks ago and have a partial work-around. This doesn't allow full control, but you can add a UI macro on individual catalog items to show the record preview button for read-only variables. In some cases, the button is only hidden via CSS.
Known Limitations
1. This can be applied to individual catalog items, but will impact all read-only reference variables. If you need a more granular solution, you would need to edit the UI macro to only impact that field.
2. This only works for fields that are made read-only via client-side logic. This will not work for variables that are read-only via ACL or variable permissions.
Catalog Variable
Column | Value |
Type | Custom |
Order | 1 (I put this at the top, but not sure if this is required) |
Macro | enable_catalog_readonly_clickthrough (see macro below) |
Visible Elsewhere | true |
UI Macro (enable_catalog_readonly_clickthrough)
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<style>
.sc_variable_editor .input-group-btn span[id$="LINK"] span[name^="ni.VE"] {
display: inline !important;
}
</style>
</j:jelly>
I created a variable set for this to make it easier to apply to other catalog items. Should also make it easier to locate the forms that need to be refactored when an official solution comes along.
Hope this helps!
Jason Diggs