Create RITM from script - workflow initiations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2017 07:36 AM
Hi,
i have a script that create RITM.
In that script, i'm creating Request (REQ), then creating requested item ( RITM), then adding the relevant variables and triggering the workflow withe the workflow startFlow function.
i have noticed that in this process, the requested item have 2 running workflows.
After investigating the issue, i have discovered the that the workflows are created in the points:
1. when is created the RITM
2, when i user the StartFlow function.
The flow that is created with i create the RITM does not take into account the variables, since the variables are not available on creation, only after.
My question is - how can i create the RITM without triggering the workflow.
this is the script for creating the RITM:
===========================================
var elem = new GlideRecord("sc_req_item");
elem.cat_item = cat_item;
elem.request = idreq;
elem.u_requested_for = caller_id;
elem.quantity = 1;
var id_reqitem = elem.insert();
if (!elem.get(id_reqitem)) {
return null;
}
return id_reqitem;
==========================================
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2017 11:10 AM
I'm trying to do the same thing as Eli.
The problem with the cart is that it creates a new REQ (sc_request). I want my generated RITM to be associated with the current request.
I've even tried using the cart, then after creating it, modifying the <ritm>.request value to be the original request.
Nothing seems to be working.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2017 12:12 PM
Hey Ty,
I know that you just posted your message a day ago, but I was wondering if you had any further insight or ideas. I am trying to do something similar to create a better user experience for our support desk to allow them to add RITMs to an existing REQ - I'd love to sync up and chat about what you have already done if you are available.
Thanks,
Chris
Regards,
Chris Perry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2017 10:51 AM
Hey guys, I have a similar requirement. Has anyone been able to create RITMs via script and then add them to an existing REQ successfully?
Another thing I notice is that when I create a sc_req_item record and set the item field to a sc_cat_item, the variables from the cat item don't appear in the sc_req_item that gets created.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2017 11:41 AM
Hey Eric,
The closest I have been able to get to achieving this is by using the OOB 'GlideappCalculationHelper' API: GlideappCalculationHelper - Global
That solution is not ideal because the workflow for the RITM is kicked off as soon as the RITM is added to the REQ, but I have not been able to find anything else that gets as close.
Regards,
Chris Perry