How can I Apply UI policy on Multiple catalog items

Heisenberg
Tera Contributor

Hi,

I have created a Catalog UI policy for variable set in one of the catalog item, now I need to apply the same UI policy to multiple catalog items which is using the same variable set(its a mult-row variable set).

Please advice a script if I can apply the same UI policy to be created or applied to multiple catalog items.

10 REPLIES 10

Hi Namrata,

It doesnt work for multi-row variable set.

Basically I need a script to create UI policy for multiple catalog items

Hey Heisenberg,

I have just tried it for multi-row variable set.

and it Works!

Thanks

Namrata.

Hi,

find_real_file.png

My Variable set (name is New )is Multi Row Varibale Set.

Refer the Screenshot.

Hi,

 

@Brad Tilton has given good article on Multi Row Variable set and scripting with MRVS.

 

Below script gives you a Name of all variable in variable set 

var mrvs;
var itemID = '70506da8db002300e69dfbef2996194a'; //Pass your sys_id of variable set
var ritmGR = new GlideRecord('sc_req_item');
if (ritmGR.get(itemID)) {
    mrvs = ritmGR.variables.mrvs_internal_name;; //pass your a backend name of variable in Multi Row Variable Set(internal_name)
}
gs.print(mrvs);

 

Below script using for loop we iterate each rows and get the display value of each variable

var current = new GlideRecord('sc_req_item');
current.get('6be98d3edbed7b407eee785e0f961916');

var mrvs = current.variables.mrvs_internal_name;

var totalRows = mrvs.getRowCount();

for (var i = 0; i < totalRows; i++) {
  gs.addInfoMessage('Display Value: ' + mrvs.getRow(i).getCell('variable_name').getCellDisplayValue());
}

 

Exploring The Multi row variable set

https://community.servicenow.com/community?id=community_blog&sys_id=7cc66514db882380e0e80b55ca961965

Scripting the Multi-row variable set

https://community.servicenow.com/community?id=community_blog&sys_id=865b5aeddbc023c0feb1a851ca9619f9

 

I hope it will give you a way to work on Multi Row Variable Set.

 

Thanks,

Kunal.

Namrata Khabale
Giga Guru

Hi,

Here is the Detail Screenshots of Scenario:

Step1: Go to Catalog UI Policy.

            

 

 Note:My Variable set name is New.

find_real_file.png

 

Step2: My new Catalog item is New Comm.

            Go to variable set section of other Catalog item.

            Click on Edit.

 

find_real_file.png

Search a New Variable set.(New is a name of my variable Set).

Select that variable set by Double clicking on it.

 

 

find_real_file.png

 

If it works for you,Mark My answer Correct and Helpful.

 

Thanks,

Namrata.