- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2024 07:36 AM
Hi all,
I have imported a catalog item through excel sheet (using Import sets and Transform map), I then imported Variable sets followed by Variables into their respective tables using same method, then I had to add the variable set in the catalog item manually. everything worked perfectly fine. Now that I want to Import Variable set such that I don't have to add it manually to the catalog item. after importing variable set it must be directly appearing in the variable sets of catalog item.
Can anyone help with the solution?
Thanks and Regards,
Ehab Pilloor
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2024 10:03 AM
for a variable set to appear in catalog item, a record must be present in 'io_set_item' table which has two reference fields "variable set" and "catalog item".
you can write an OnAfter Transform script to create a record on the 'io_set_item' table, and the catalog item will automatically have the imported variable set.
- (function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
- var gr = new GlideRecord('io_set_item');
- var grsc = new GlideRecord('sc_cat_item');
- grsc.addQuery('name', source.u_catalog_item);
- grsc.query();
- if(grsc.next())
- {
- gs.log(grsc.getUniqueValue());
- gr.setValue('sc_cat_item', grsc.getUniqueValue());
- }
- gr.setValue('variable_set', target.getUniqueValue());
- gr.insert();
- })(source, map, log, target);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2024 10:03 AM
for a variable set to appear in catalog item, a record must be present in 'io_set_item' table which has two reference fields "variable set" and "catalog item".
you can write an OnAfter Transform script to create a record on the 'io_set_item' table, and the catalog item will automatically have the imported variable set.
- (function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
- var gr = new GlideRecord('io_set_item');
- var grsc = new GlideRecord('sc_cat_item');
- grsc.addQuery('name', source.u_catalog_item);
- grsc.query();
- if(grsc.next())
- {
- gs.log(grsc.getUniqueValue());
- gr.setValue('sc_cat_item', grsc.getUniqueValue());
- }
- gr.setValue('variable_set', target.getUniqueValue());
- gr.insert();
- })(source, map, log, target);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2024 10:09 AM
Hi @Ehab Pilloor ,
Please refer to below thread":
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda