
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2014 07:00 AM
I'm trying to figure out a way to make a client script work on all the requested items without having to copy it so many times... If I just leave the field for "Catalog Item" blank, the script apparently doesn't work at all. I could add a variable set to all the items and make the script work on it, but it would still require updating all the items... Can this be done with a UI script maybe?..
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2015 04:32 AM
Hi,
I had the same problem but you can easily add whatever variable sets to your items using a scheduled script e.g. a scheculed script that runs every night perhaps checking all cat items against the catitem:var set linking table and creating a relationship if one dosn't exist:
e.g.
var item = new GlideRecord('sc_cat_item');
item.addQuery('active',true);
item.query();
gs.log('I found' + item.getRowCount() + ' items', 'TEST');
while (item.next()) {
var itm = item.sys_id;
var cost = "bf87fe6b6f8b310064b8d7f16e3ee4f2"; //Sys_id of costcentre Variable set
var vset = new GlideRecord('io_set_item');
vset.addQuery('variable_set',cost);
vset.addQuery('sc_cat_item',itm);
vset.query();
if(vset.next()){
gs.log("This item: " + item.name + " Is already linked to cost var set",'TEST');
} else {
gs.log("I need to create a link to Cost for: " + item.name,'TEST');
vset.initialize();
vset.variable_set = cost;
vset.sc_cat_item = itm;
vset.insert();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2014 07:13 AM
Hi Valentina,
Im a little confused whether you want to create a global script to run on all the catalog items, or a global script to run on all the requested items.
if its on cat items then the table will be sc_cat_item
if its on RITM then the table will be sc_req_item
if this does not help, can you please elaborate on what do you want

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2014 07:15 AM
Hi Valentina,
You could do this with a global ui script, but then it runs on every page load, not just items.
I would go the catalog client script/variable set route. You can actually pretty easily add it to all of the items through the related list on the variable set record. You could even automate it with a business rule that automatically adds the variable set to new items.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2016 08:47 AM
Hi Brad,
Thanks for the suggestion. I am trying to populate a notes on every catalog item (which is in a variable set) form the new call. I am passing the short description from the new call into a URl and reading in a client script on the catalog item.
Do you think doing it via variable set route will effect any way (for example, if a catalog item is ordered outside (not from new call))?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2014 07:17 AM
Can you elaborate a bit more on what it is you are trying to accomplish. I'm assuming you want this script to run, or at least be available to all the catalog items when the user is ordering them, correct?