- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2022 09:37 AM
On Catalog UI Policy - what happen when 'Reverse if false' is true and the action 'Clear the variable name' is false?
Does that mean if the condition of the UI policy is false then the value of the variable with be clear?
The behavior I am seeing is the value does not get clear.
Solved! Go to Solution.
- Labels:
-
User Interface (UI)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2022 11:39 PM
Checking "Clear the variable value" checkbox is to activate a process to clear field value. When it's unchecked, the process is inactivated.
The checkbox is like adding the following script in "Execute if true" condition.
function onCondition() {
g_form.clearValue('field1'); // field name to clear
}
Other UI Policy conditions such as "Mandatory", "Visible", "Read only" have opposites but there's no opposite process to "Clear the variable value" because the script would not know what to populate the field with. In other words, "Mandatory", "Visible", "Read only" are always activated but "Clear the variable value" would only become activated when it is checked. That's probably why "Clear the variable value" is a checkbox like "Activate" checkboxes in other pages.
As such, checking it will activate it and unchecking will inactivate clearing the field. When it is inactivated, nothing will be done whether the condition is satisfied or unsatisfied.
Going back to the original question, if ""Clear the variable value" is unchecked, nothing will happen regardless of whether "Reverse if false" is true or false.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2022 11:39 PM
Checking "Clear the variable value" checkbox is to activate a process to clear field value. When it's unchecked, the process is inactivated.
The checkbox is like adding the following script in "Execute if true" condition.
function onCondition() {
g_form.clearValue('field1'); // field name to clear
}
Other UI Policy conditions such as "Mandatory", "Visible", "Read only" have opposites but there's no opposite process to "Clear the variable value" because the script would not know what to populate the field with. In other words, "Mandatory", "Visible", "Read only" are always activated but "Clear the variable value" would only become activated when it is checked. That's probably why "Clear the variable value" is a checkbox like "Activate" checkboxes in other pages.
As such, checking it will activate it and unchecking will inactivate clearing the field. When it is inactivated, nothing will be done whether the condition is satisfied or unsatisfied.
Going back to the original question, if ""Clear the variable value" is unchecked, nothing will happen regardless of whether "Reverse if false" is true or false.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 06:19 AM
I feel like the 'Reverse if false' it is kind of misleading because I would expect the following cases:
Condition | Reverse If false | Clear the variable value | Result |
True | True | True | Value gets clear |
True | True | False | Nothing happens |
True | False | False | Nothing happens |
False | True | True | Nothing happens |
False | True | False | Value gets clear |
False | False | False | Nothing happens |
It is inconvenient that I have to create an opposite UI Policy for each UI Policy with visible actions to clear the value in case user enter value and the the variable gets hidden. It is extremely difficult to keeping track of all this UI Policy in a catalog item with large number of variable that get hidden.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 06:26 AM
It is definitely something you have to get used to, though it works very nice.
Don't know what you define as a large number of variables, though if it's like a Catalog Item with 100 variables then you don't have an issue with Reverse if false, then you actually have an issue with the original design of your Catalog Item.
Kind regards,
Mark
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field