Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Hide select fields in Variable Editor but not on form

kroghet
Kilo Explorer

Hi guys, 

I have a record producer where I have mapped some of my variables to fields on the back-end. However I also have some variables I want to have shown in the Variable editor. So I would like to Hide the ones that is mapped to a specific field. 

 On the attachment, I have a variable that is mapped to a field, so I would like to hide the one in the variable editor, but not on the form. I have tried to look in the UI policy, but I only see one name, so not sure how to single out the one form the Variable Editor. 

I hope the explanation make sense 🙂

 

1 ACCEPTED SOLUTION

lasse3
Giga Guru

Create a Catolog UI Policy on the Record Producer and check the checkbox "Applies on Target Record" and uncheck the box "Applies on a Catalog Item view".

Now you can build a UI Policy that removes the fields that you do not wish to have visible on the target record.

View solution in original post

6 REPLIES 6

Prateek kumar
Mega Sage

Please check the below thread.

Hide Variables


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

kroghet
Kilo Explorer

Maybe I am doing something wrong, but when I use UI Policy I can only find the variable on the form (Red circle) I can't find the variable from the Variable Editor (Black circle) on the list, to choose to hide. And I want to hide the one from the Variable Editor, not the one on the form.  

Ok lets do this.

Configure a UI policy on the record producer itself and make this UI policy to be applicable on the target record.

find_real_file.png

 


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

Snehal Pawar
Tera Expert
You can use below script where you can fetch your variables present in your variable set which needs to be hidden: Script: Script Include Name: GetVariables and make your Script Include as Client Callable var GetVariables = Class.create(); GetVariables.prototype = Object.extendsObject(AbstractAjaxProcessor, { getVariable : function() { var answer = ''; var gr1=new GlideRecord('item_option_new'); gr1.addEncodedQuery('variable_set=d6965b6b4fd40700592d52411310c73f'); // Replace your Variable set Id which you want to hide gr1.query(); while(gr1.next()) { answer=answer+ gr1.name+','; } return answer; }, type: 'GetVariables' }); Please mark helpful or correct if it answer your question. Thanks Snehal