Order Catalog Item and tag to existing Request. It will attach to the existing Request and generate new RITM and then update variable
var childItem = 'sys_id of item'; var reqHelper = new GlideappCalculationHelper(); reqHelper.addItemToExistingRequest(current.request, childItem, 1); reqHelper.rebalanceRequest(current.request); //update/add values to variables on item var grReqItem = new GlideRecord('sc_req_item'); grReqItem.addQuery('request', current.request); grReqItem.addNullQuery('parent'); grReqItem.addQuery('cat_item', childItem); grReqItem.query(); if (grReqItem.next()) { grReqItem.variables.requested_for = 'user_sys_id'; grReqItem.parent = current.sys_id; grReqItem.variables.access = true; grReqItem.update(); }
One response
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.