How to make the variables from record producers read only on a case form.

Daniel R2
Kilo Sage

Hi,

 

On our current project. On case forms, we are displaying the record producer variables on the case form.

However after the request has been submitted and an agent is working on the case. It is possible for them to edit the variables from the case form.

However we dont want this to be possible. How can we make these variable fields read only so an agent can not edit the requesters answers?

 

DanielRyszka_0-1675685136437.png

 

6 REPLIES 6

Salah Qawaqneh
Mega Guru

Hi Daniel Ryszka

 

Another way is an onLoad client script on your case form to set your variable editor to read-only

 

function onLoad() {
   g_form.setVariablesReadOnly(true);
}

 

 

 

 

MattSN
Mega Sage
Mega Sage

For anyone that may come across this, when you want to set variables read only on a custom task table a few things need to be in place.

 

From https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0863000 

Variables created with a record producer will record to the sc_item_produced_record table. If creating a record with a script does not include this the OOB client function g_form.setVariablesReadOnly(true) will not work. You can address by adding to your script/flow an updated to the sc_item_produced_record table.