How to Set Read only for Incident variable Editor on incident form

Srinivasu2
Tera Contributor

Hi Community,

 

I have created a high severity portal form using the Record Producer, and it has been placed in the ESC Portal.

 

And I have included the 'Incident Variable Editor' on the incident form whenever a user submits the above form from the ESC portal. Then, the incident variable editor is visible as shown below

 

Srinivasu2_0-1715167552709.png

 

The requirement is to set the Incident Variable Editor on the incident as read-only

 

Please help me with how to set the Incident Variable Editor to read-only

 

Thanks,

Srinivasu

 

1 ACCEPTED SOLUTION

Ramz
Mega Sage

Hi @Srinivasu2 ,

To set the Variable Editor to read only a different table like incident, please follow these steps:

  1. Create a Client Script on the Incident table
  2. Paste the following script:
    function onLoad() { 
    $("variable_map").querySelectorAll("item").forEach(function(item){
    var variable = item.getAttribute("qname"); 
    g_form.setReadOnly("variables."+ variable, true); 
    }); 
    }
  3. This will require to uncheck (set to false) the "isolate script" checkbox (This checkbox is not on the form by default) Steps below how to bring it to the form)
    1. To do that right click in the header -> Configure -> Form Layout
    2. On the left side find "Isolate script" and bring it to the right and save
  4. Save changes
    This should make the Variable Editor on the incident table read-only

Please follow this article for further reference :https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0752560

 

Please mark my answer correct/helpful if it resolved your query

View solution in original post

6 REPLIES 6

Ramz
Mega Sage

Hi @Srinivasu2 ,

To set the Variable Editor to read only a different table like incident, please follow these steps:

  1. Create a Client Script on the Incident table
  2. Paste the following script:
    function onLoad() { 
    $("variable_map").querySelectorAll("item").forEach(function(item){
    var variable = item.getAttribute("qname"); 
    g_form.setReadOnly("variables."+ variable, true); 
    }); 
    }
  3. This will require to uncheck (set to false) the "isolate script" checkbox (This checkbox is not on the form by default) Steps below how to bring it to the form)
    1. To do that right click in the header -> Configure -> Form Layout
    2. On the left side find "Isolate script" and bring it to the right and save
  4. Save changes
    This should make the Variable Editor on the incident table read-only

Please follow this article for further reference :https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0752560

 

Please mark my answer correct/helpful if it resolved your query

Nadir Abbas
Tera Contributor

change the ui macro