How to hide variable set on record producer?

Frank
Mega Expert

I've gone through the community and tried several methods and nothing seems to work.

  • g_form.setDisplay('variable_set_name', false)
  • g_form.setVisible('variable_set_name', false)

I've even tired using a UI Policy with no luck. I tried to just hide the variables in the variable set and I could get it to hide them.

Can it be done? I'd also like it to work on the Service Portal.

Thanks,

Frank

1 ACCEPTED SOLUTION

Mark Roethof
Tera Patron
Tera Patron

Hi there,

You should be able to hide Variable Sets and Multi Row Variable Sets. Thru scripting like you are mentioning, though also thru no code solutions like Catalog UI Policy. Thing to be aware of: if there is already one field mandatory in your variable set, hiding will not work (you should then make that mandatory field conditionally mandatory)!

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

5 REPLIES 5

Hendrik Odendaa
ServiceNow Employee
ServiceNow Employee

In my case I also needed to check that there aren't any containers in your variable set. If there are, you'll need to handle the containers in the variable set with their own line of code to set their visibility.
ServiceNow sees the variable set as something like a container, so having containers in the variable set confuses the UI Policy a bit.