- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2017 11:41 PM
Hello Everyone,
I have an inbound action that creates REQ and RITM and call an existing workflow. All thanks to this article from Mike Kaufman. What I want to do now is to include the Item Variables on the RITM and it's catalog task. I also want to set the approver based on the manager that will be put on the body of the email. The Item is Request new SharePoint Site collection. Here is my existing code:
createRequest();
function createRequest() {
var genReq = new GlideRecord ("sc_request");
genReq.initialize();
genReq.requested_for = email.from;
genReq.short_description = email.subject.toString();
genReq.description = "received from: " + email.origemail + "\n\n" + email.body_text;
var reqID = genReq.insert();
current.requested_for = email.from;
current.short_description = email.subject.toString();
current.description = "received from: " + email.origemail + "\n\n" + email.body_text;
current.cat_item = '79e3994037a98200e07a261953990ea3';
current.parent = reqID;
current.request = reqID;
current.insert();
var w = new Workflow();
wfSysId = w.getWorkflowFromName("Request new SharePoint site collection");
w.startFlow(wfSysId, current, current.operation());
}
The existing variables for Request new SharePoint site collection are these:
site_collection_type - Select Box
title - Single Line Text
planviewID - Single Line Text
owner_0 - Reference
I want to set all of these variables from the email body.
HOW TO DO THIS? Thank you and looking forward for your help!!!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2017 11:48 PM
Hello Diane,
Refer the below links may helpful to you.
How to launch Catalog Items from Email
Create Request from Inbound Email Action
Submit a catalog item through Email inbound action
ServiceNow Commnunity MVP -2018 class.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2017 02:09 AM
Hi Diane
you will have to use cart functionality to put variable via background, also it would be really easy since it is coming from email.
if still you want to go by creating item directly then you can put variable values in variable ownership table, where normally values of variables are stored.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2017 03:57 AM
Hi Girish,
Will you show me the script for setting the variable in the item? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2017 05:10 AM
this would be still a band-aid which you could apply and complete your requirement
// create record
//table where you store relationship between variabel and value
var scopt = new GlideRecord('sc_item_option');
scopt.initialize();
scopt.item_option_new='3eee186ddbc903002f30f6dfbf961944'; //sys_id of varible record
scopt.value=2.5; // variable value
var varSys_id = scopt.insert();
gs.log(' this is sys_id ' + varSys_id);
//table where you link above record with RITM
var scopt1 = new GlideRecord('sc_item_option_mtom');
scopt1.initialize();
scopt1.sc_item_option=varSys_id; // sys_id of the above record
scopt1.request_item='3d8f8636db3003002f30f6dfbf9619ca'; // ritm sys_id
gs.log(' this is sys_id ' + scopt1.insert());

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2018 07:46 AM
I have a similar question: I don't have a workflow currently I know how to create a request from inbound email, but it does not create a RITM or TASK. Is there a way to create a request from an inbound email with a RITM and TASK created? We are on Kingston.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2019 05:49 AM
Hi Diane,
Did u find solution for this,
If so please help me with script.