Search code examples
servicenow

How to setReadOnly() on all task variables (ServiceNow)


Is there a way on a catalog task, (sc_task) to set all the visible variables to read only? One of my catalog items shows different variables on different tasks, so I'm hoping for an onLoad script that can 'disable all variables visible on this task'.

What I have so far is:
A catalog client script with all possible variables hardcoded to readonly (whether they're displayed or not).

It works, but I was hoping for a nicer way to access the variables on the task. (This is San Diego)


Solution

  • Use g_form.setVariablesReadOnly(true) .

    (Thanks to @Ben in the ServiceNow Slack)