- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2016 08:11 AM
Hi,
I'm trying to order a new catalog item from a workflow runScript action, the newly created item should be added to the current REQ, after it's creation the RITM is added to the current REQ wich is good, but when I open that RITM, there are no workflow and Variables.
This what I've done so far...
function createRequestItem() {
var grReqItem = new GlideRecord("sc_req_item");
grReqItem.initialize();
grReqItem.requested_for = current.variables.requested_for;
grReqItem.cat_item = '8a36d3850f6e924033859bd692050ef6';
grReqItem.request = current.request;
grReqItem.variables.v_current_carrier = current.variables.carrier_name;
grReqItem.variables.v_current_number = current.variables.wireless_num;
grReqItem.variables.v_request_type = "iPhone Activation only";
var reqItemSysId = grReqItem.insert();
gs.addInfoMessage('Request Item Created: ' + reqItemSysId);
gs.addInfoMessage('Request Created: ' + grReqItem.number);
}
createRequestItem();
Please if everyone have a better way to do this please let me know
Solved! Go to Solution.
- Labels:
-
Service Catalog
-
Workflow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2016 08:16 AM
I just reread that you're looking to add an item to an existing request, which is a little more difficult but doable. Here are some threads to follow:
How to add a new item to an existing request with catalog variables

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2016 08:13 AM
The catalog has its own API for ordering that's a little different than just inserting a gliderecord.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2016 08:16 AM
I just reread that you're looking to add an item to an existing request, which is a little more difficult but doable. Here are some threads to follow:
How to add a new item to an existing request with catalog variables
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2016 08:14 AM
You need to use this:
http://wiki.servicenow.com/index.php?title=Service_Catalog_Script_API#gsc.tab=0
It will help you create a requested item properly.