Make Preview Page in CSM Portal Reference Field Read-only

Shiladitya Das
Tera Contributor

Hi All,

 

We've a requirement to make all fields read-only in the pop-up view when the info (i) icon is clicked for any reference field in CSM Portal for a specific role. Is there a way to achieve this?

1 REPLY 1

Punit S
Giga Guru

Yes, you can achieve this by creating a UI policy in ServiceNow. Here are the steps to create a UI policy to make all fields read-only in the pop-up view when the info (i) icon is clicked for any reference field in CSM Portal for a specific role:

  1. Navigate to UI Policies in the ServiceNow navigator.

  2. Click on the 'New' button to create a new UI policy.

  3. In the 'UI Policy' form, fill in the following details:

  • Name: Enter a name for the UI policy.
  • Description: Enter a description for the UI policy.
  • Table: Select the table for which you want to create the UI policy.
  • Type: Select the type as 'All'.
  1. In the 'Conditions' section, add a condition to check if the user has a specific role. You can use the 'User Criteria' condition type and specify the role(s) for which you want to make the fields read-only.

  2. In the 'Advanced' section, add the following script:

 

function onCondition() {
  var g_form = g_modal.getOutputRecord();
  g_form.setReadonly(true);
}

 

  1. Save the UI policy.

This UI policy will make all fields read-only in the pop-up view when the info (i) icon is clicked for any reference field in CSM Portal for the specific role(s) you have specified in the condition. You can modify the script as needed to achieve different behavior or add additional conditions to restrict the read-only access further.

Please mark my answer as a solution/helpful in case it adds value and moves you a step closer to your desired ServiceNow solution goal.

Thanks,
Punit