Issue in Inserting a Record in 'io_set_item' table to create the relationship between hardware Catalog item and Variable Set through Business Rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2019 12:09 PM
Hi All,
Issue in Inserting a Record in 'io_set_item' table to create the relationship between hardware Catalog item and Variable Set through Business Rule.
When the hardware catalog item is published from related link in the model record, I am trying to attach the variable set to the hardware catalog item through business rule on 'pc_hardware catalog item' table, 'After' 'Insert'.
Script:
var gr1 = new GlideRecord("io_set_item");
gr1.initialize();
gr1.setValue('variable_set', '1b7cfa591ba00010fe568733cc4bcbf2');
gr1.setValue('sc_cat_item', current.sys_id);
gr1.order = '100';
gr1.insert();
Problem is when I am trying to run, Variable set is attaching to hardware catalog item but at the same time, variables which are existing in the variable set are getting created again.
If I am trying to run the script through 'background Scripts', its running fine (creating relationship between hardware catalog and variable set). Also, duplicate variables are also not getting created.
I am not able to figure out, how the variables are getting created in side the variable set if the business rule is executed.
Thanks for the help.
- Labels:
-
Best Practices
-
Procurement
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2019 02:59 PM
Try as below
try{
var gr1 = new GlideRecord("io_set_item");
gr1.initialize();
gr1.variable_set = '1b7cfa591ba00010fe568733cc4bcbf2';
gr1.sc_cat_item = current.sys_id ;
gr1.order = '100';
gr1.insert();
}
catch(e){
gs.log('error from br'+e.message);
}