How to make the variables from record producers read only on a case form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2023 04:08 AM
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2023 03:57 AM
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);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2024 05:50 AM
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.