How to clear the value of the variable not selected on catalog form?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2020 12:06 PM
Hello Experts!
I have Select box and multi line variables on catalog form. Depends on a selection from the select box variable, it shows choices (variables) created for each select box options. If the requester adds items but then changes the selection and choose different item, I want to clear the value.
On RITM, it shows the items that are selected on catalog form only. But on approval form, it shows all those are entered, even if selection was changed afterwards(before submission).
I want it to clear the value if that variable is not selected and set N/A.
I have Run script set in the beginning of the workflow:
if (current.variables.Variable_1.nil())
{
current.variables.Variable_1 = 'N/A';
}
Which works if the variable never got any value entered but once any value is given, it doesn't clear the value and set N/A instead even after requester changes the selection.
All/Any help is appreciated!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2020 12:14 PM
Hi,
Can you confirm the version of ServiceNow that is being used once. As post London release of ServiceNow there exists an OOB field 'Clear the variable value' for every UI Policy Action that can be leveraged.
In addition, give link a check.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2020 08:19 AM
Hello Jaspal,
Thank you for quick reply!
Version of ServiceNow is New York.
I was able to achieve this with clear the variable value option but then it will not show N/A for the variables that are not selected. I have run script activity in the beginning of the workflow with below script:
if (current.variables.Variable_1.nil())
{
current.variables.Variable_1 = 'N/A';
}
Please suggest what needs to be done to clear the value for the variable not selected and show N/A for all of them.
Appreciate your help!