Copying RITM variables into catalog task variables

SNOW32
Giga Expert

I need to add variables that display on the RITM form to display on the catalog task.

However, I need the same variables to display on the catalog task form or in description field. After going through google as well as community blogs I have found  write UI Policies in Variable set and business rule. I can't use UI Policy as I haven't created Variable Set..I have created variables separately  in catalog item.Tried adding Variable Editor to the 'Form Layout' and it did not work. I think it can be resolved by business rule.

Here is the information which I got from community. How they are related from Variable definition all the way to the values on your RITM/CTASK.Here is a rundown of the tables involved:

 

  • sc_cat_item] holds the definitions for your Catalog Items
  • [item_option_new] holds definitions of variables
  • [item_option_new_set] holds definitions of variable sets
  • [io_set_item] is a many-to-many table relating Variable Sets to Catalog items
  • [sc_cart] contains the shopping cart for users
  • [sc_cart_item] contains the items a user has placed in the cart
  • [sc_item_option] contains the values a user has entered for the variables associated to the items in the cart
  • [sc_item_option_mtom] is a many-to-many table relating these variable values to their respective Requested Items
  • [sc_item_variables_task] is a many-to-many table relating these same variables to their respective Catalog Tasks (if one gets created)

I got below Business rule while searching for solution...

var count = 0;

 

  var gr = new GlideRecord('u_bundle_item_catalog');

 

  gr.addQuery('u_active', true);

 

  gr.addQuery('u_bundle', '!=', '');

 

  gr.query();

 

  while (gr.next()) {

 

  var list = gr.u_bundle.toString();

 

  var array = list.split(",");

 

  var reqitem = new GlideRecord('sc_req_item');

 

  reqitem.addQuery('request', current.sys_id);

 

  reqitem.addQuery('cat_item', '66f666a14f6746006dbd926ca310c7ce'); //Sys iD of New Hire Instrauction Item

 

  reqitem.query();

 

  if(reqitem.next()) {

 

  for (var i=0; i < array.length; i++) {

 

  if(reqitem.variables.bundle == array[i]) {

 

  var reqHelper = new GlideappCalculationHelper();

 

  reqHelper.addItemToExistingRequest(current.sys_id,'0d29a6084fd742006dbd926ca310c770','1'); // Sysid of Hardware Item and 1 is the qty

 

  reqHelper.rebalanceRequest(current.sys_id);

 

 

 

  //update variables

 

  var grReqItem = new GlideRecord('sc_req_item');

 

  grReqItem.addQuery('request', current.sys_id);

 

  grReqItem.addQuery('cat_item','0d29a6084fd742006dbd926ca310c770');

 

  grReqItem.query();

 

  while (grReqItem.next()) {

 

  if(grReqItem.variables.sub_category == '') {

 

  grReqItem.variables.sub_category = gr.u_subcategory;

 

  }

 

  if(grReqItem.variables.item_name == '') {

 

  grReqItem.variables.item_name = gr.u_item_name;

 

  }

 

  grReqItem.variables.desk_number = "NA as New Hire";

 

  grReqItem.variables.computer_name = "NA as New Hire";

 

  grReqItem.variables.reason = "new_hire";

 

  grReqItem.variables.short_description = "Created as part of Bundle: " +array[i];

 

  grReqItem.variables.details = "Created as part of Bundle: " +array[i];

 

  grReqItem.short_description = "Created as part of Bundle: " +array[i];

 

  grReqItem.description = "Created as part of Bundle: " +array[i];

 

  grReqItem.variables.employee_name = reqitem.variables.employee_name;

 

  grReqItem.variables.employee_start_date = reqitem.variables.employee_start_date;

 

  grReqItem.variables.employee_type = reqitem.variables.employee_type;

 

  grReqItem.variables.department = reqitem.variables.department;

 

  grReqItem.variables.cost_center = reqitem.variables.cost_center;

 

  grReqItem.variables.address = reqitem.variables.address;

 

  grReqItem.update();}

  }

 }

 }

}

I tried to write business rule with customizing the business rule scipt, But It didnt work

 Any ideas on how this might be able to function?

 

Thanks in advance!

Anu

 

1 ACCEPTED SOLUTION

click on gear icon on variable list and select the column "global" and then select it from available slush bucket to selected.

find_real_file.png

 

now make the changes from the list.

find_real_file.png

 

or you can also add the field by opening one variable and adding the field from configure>> form layout

 

 

View solution in original post

6 REPLIES 6

SURAJ3
Giga Contributor

@Harshvardhan , this was really helpfull, i was struggling from 1 week.

And about multi-row variable set variables?