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

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 abc1=new GlideRecord('item_option_new'); abc1.addEncodedQuery('variable_set=d6965b6b4fd40700592d52411310c73f'); // Replace your Variable set Id which you want to hide abc1.query(); while(abc1.next()) { answer=answer+ abc1.name+','; } return answer; }, type: 'GetVariables' }); Please mark helpful or correct if it answer your question. Thanks Snehal

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.