show variable question based on previous variable answer

Brian S5
Kilo Sage

I've searched the wiki and the Forums and have been trying to figure out how to solve the current issue i am faced with.

 

I have created a Record producer that has a set list of questions based on creating a custom report.

 

I am trying to figure out how to show and hide the fields using a UI policy based on the answers to the questions.

 

So if a question was something like "would u like the report to be grouped ?" and its a yes/no question and the selection is either a yes or no, how do i hide/show a single line text box below the question based on that yes/no answer ?

 

I don't know where i can reference the answer to that variable question in a script to show or hide the single line text box.

I tried searching the conditions fields but i don't see anything with an variable answer. I started out thinking i could just create client script, but through research found a ui policy to work better for the job, however i cant seem to get the variable correct. I am mediocre at coding.

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You should be able to use a catalog ui policy to show or hide a text variable based on a yes/no variable. The ui policy has two parts. First, you would need to save the catalog ui policy record and associate it with your catalog item or record producer and then build the condition based on the yes/no variable. Next you would create a ui policy action that will show your text variable. Something like this:


6lqKj.png


View solution in original post

3 REPLIES 3

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You should be able to use a catalog ui policy to show or hide a text variable based on a yes/no variable. The ui policy has two parts. First, you would need to save the catalog ui policy record and associate it with your catalog item or record producer and then build the condition based on the yes/no variable. Next you would create a ui policy action that will show your text variable. Something like this:


6lqKj.png


Awesome! Exactly what I needed. I already had 2 UI policies from the previous Service Request that I was trying to use and I just changed the catalog item to the new one I was working on, changed the conditions and voila! thanks again.


randrews
Tera Guru

one thing to remember when doing this is to cascade all conditions to the final block



so for example ..



they pick a system


they pick a type of report


they get a text box...



the conditions for the text box should include BOTH the system and type of report... or if they change the system the text box will still show even though it isn't valid anymore.