Best way to handle clearing values from hidden variables ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2016 02:11 PM
Hi,
I wanted to know what the best way to clear values from catalog item variables that are hidden.
Here is the scenario, I have a catalog item with several variables. I also have UI Policies that make variables visible depending on the value selected in a different variable. If I selected "Yes" in VAR1 to make the VAR2 visible, then entered a value in VAR2, but changed my mind and selected "No" in VAR1 to make VAR2 disappear again. The VAR2 value is still stored and will write to the tables which will cause problems in my notifications since I am sending all variables values that are not null.
What is the best way to clear out the values from variables that are hidden?
Thanks,
Johnny
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2016 09:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2016 06:43 AM
Thanks Srini.
Is there a way that a script can be created to generically clear the values of any variable that is hidden without having to specifically call out the variable name?
I'm not a javascript programmer, so my knowledge is rather limited.
Regards,
Johnny

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2016 06:52 AM
Hi Johny,
You can start with below link on how to set or clear values via script.
GlideForm (g form) - ServiceNow Wiki
I will get back to you in case I found any easy way for this req.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2016 07:45 AM
Were you ever able to find a way to script this? Right now, my client scripts are so messy because every time i hide a variable, I'm having to specifically clear its value. Also, were you having to clear list collectors as well? I'm trying to figure out how to identify the type of variable so I can either us clearValue or a script I found on servicenowguru to move the selections to the left bucket when a list collector.