deepakgarg
ServiceNow Employee
ServiceNow Employee

So, how does the Deadlock Scenario look like?

  1. Make a variable hidden without providing any default value.
  2. Next, make the variable mandatory (via UI policy/Client script).
  3. Now that the variable is hidden, you won't be able to provide a value.
  4. Since you did not satisfy the mandatory rule for the variable, you won't be able to submit the form.

Eg:

Picture1.png

"Working with catalog variables can be a breeze, if you understand how they tend to behave when you set them to 'Mandatory'"

Using Roles to Set Variable to Read-only

Ideally, avoid using 'Create Roles' and 'Write Roles' to make a mandatory variable read-only/hidden. Instead use UI Policies or Client Scripts to achieve the same behavior.

However, if you must use 'Create Roles' and 'Write Roles' for a variable, then always set a default value. This will ensure that the form is allowed to be submitted with the variable's default value.

Dos

Verify the following points to avoid a deadlock situation, for mandatory variables:

  • Check whether the variable has 'Create Roles' or 'Write Roles'.
  • Check if any UI policies/ Client scripts are hiding the variable or making it read-only.

Don'ts!

  1. Do not set a variable to mandatory and have a 'Create Role' or 'Write Role' for some specific user role (say, nobody). In this case, none of the users will be able to submit item form because variable will be read-only and mandatory for them.
  2. Do not hide or set a variable to read-only via UI policy/Client script and then set the same variable mandatory.
Version history
Last update:
‎09-06-2016 07:25 AM
Updated by: