Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Fill out the variables of an Item using inbound action

dianemiro
Kilo Sage

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!!!

1 ACCEPTED SOLUTION
9 REPLIES 9

Aakash Shah4
Tera Guru

Hi Aakash,



Thanks for the quick response but I have gone through this article before I posted this question and it doesn't help me because it uses the CART API which I'm not using. I also want to know how to get the values one by one from an email subject.


Not applicable

Hi Karthik,



Thanks for the quick response but I have gone through this article before I posted this question and I already did the coding but the solution doesn't include setting the variable item. I need to set the variable on the item.