How to set variables read-only in variables editors for task extended tables | General Information
In ServiceNow, we have the option of adding variable editors in task extended tables. For more information on how to set one, please refer the documentation: Configure the default variable editor for a task-extended table Kingston
Here, we learn how to set the variables read-only that get displayed in the variable editor in the form view of these tables
Let's consider "Change Request" as one of the task-extended tables.
- Open any active change request record and under header's "Additional Options" (or right-click), go to Configure > Form Layout.
- Look for an out-of-the-box setup "Change Variable Editor" (as shown in the below screenshot):
- This is actually a UI Formatter. Hence, add this editor in your form in the desired section.
- Now back to the form, this variable editor will display variables of the record producer (from where this change request was created at first place).
- Thus, under your application filter navigator go to Service Catalog > Record Producers. Look for the respective record producer and open it.
- Under "Variables" related list, you will see the list of variables defined (and of course, these hold the values in the existing change request).
- Open the variable that you prefer to keep it read only for a certain users (can be all the variables, as per business requirement).
- Post opening, check whether you have "Write roles" field showing up. If not, then kindly add this field from the form layout configuration (Configure > Form Layout).
- Once visible, this field gives you the option of which set of roles you want the users to only have "write" access on this variable.
- The following is the respective screenshot of a sample variable:
- So let's say there is a business requirement that requires all non-admin users to have read-only access to the variable in the variable editor.
- Hence, for that we would select "admin" as the right role for "Write roles". (Wow, that rhymed!)
- Once added (in the Selected section), click "Done" and save the variable form.
- Try impersonating (or log in) as one of non-admin users and open the same change request (make sure the user has access to the table and their fields).
- You will notice that the variable is in "read-only" mode in the variable editor.
- Sample screenshot:
Any supported versions.
Please do refer our product documentation: Apply permissions to a service catalog variable