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.

Create UI Policy via Script

Rafael Batistot
Kilo Patron

Hi Team,

As image below i'de like to insert this field, "catalog_conditions" using Background Script Table.

I tryed to using this code below but this specific line:
"gr.catalog_conditions = '6f4762f9939f061097e2ff747aba1032' + '=' + 'Op11BOARIBA'"

doesn't work. Anybody help me if this format is correct?

Thank you

 

var gr= new GlideRecord('catalog_ui_policy');
gr.initialize();
gr.short_description = 'Show additional details when "Others"';
gr.applies_to = 'item'
gr.active = true;
gr.applies_catalog = true
gr.catalog_conditions = '6f4762f9939f061097e2ff747aba1032' + '=' + 'Op11BOARIBA'
gr.catalog_item = '6f4762f9939f061097e2ff747aba1032'; // sys_id of Item Catalog
gr.insert();

 

 

 

 

picture.png

 

If you found this response helpful, please mark it as Helpful. If it fully answered your question, consider marking it as Correct. Doing so helps other users find accurate and useful information more easily.
1 ACCEPTED SOLUTION

Rafael Batistot
Kilo Patron

I could find a solution using the sentence like this

IO:0857223d939f061097e2ff747aba1096=Op11BOARIBA^EQ

If you found this response helpful, please mark it as Helpful. If it fully answered your question, consider marking it as Correct. Doing so helps other users find accurate and useful information more easily.

View solution in original post

5 REPLIES 5

Rafael Batistot
Kilo Patron

I could find a solution using the sentence like this

IO:0857223d939f061097e2ff747aba1096=Op11BOARIBA^EQ

If you found this response helpful, please mark it as Helpful. If it fully answered your question, consider marking it as Correct. Doing so helps other users find accurate and useful information more easily.