- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2019 02:54 PM
Hello,
I am trying to kick-off a request item from a different workflow (using sub-workflows are not maintainable/manageable). I tried using the "new Cart()" function and it works for the most part. I would like the RITM to be tied to the current REQ that the current workflow is working on.
I tried adding the last 2 lines but does not work. What would be the best way to do this?
Thanks,
createRequest();
function createRequest() {
var cartId = GlideGuid.generate(null);
workflow.info("^^^^^cartID " + cartId);
var cart = new Cart(cartId);
// Add in cart, sys_id for Internal Service Desk Request catalog item
// This sys_id is for the "Create a New User"
var item = cart.addItem('4e730823ad443c03c3ebb72244b0122');
// Fill the "Create a New User" form fields on the Current RITM variables
cart.setVariable(item, 'VS_R10_requested_for', current.variables.VS_R10_requested_for);
cart.setVariable(item, 'nars_center' , workflow.scratchpad.center);
cart.setVariable(item, 'nars_role' , workflow.scratchpad.role);
// Places order and creates request
var rc = cart.placeOrder();
rc.request=current.request;
rc.update();
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2019 03:06 PM
Hi,
There is an API named GlideAppCalculationHelper(), which you can use to dynamically generate the Requests and Request Items with variables and the workflow gets automatically added.
Please check the below links to know how can you use the API-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2019 03:06 PM
Hi,
There is an API named GlideAppCalculationHelper(), which you can use to dynamically generate the Requests and Request Items with variables and the workflow gets automatically added.
Please check the below links to know how can you use the API-