Inbound Action WF is not working

triciav
Kilo Sage

I have an inbound action to create a request.

The request and RITM is being created however my workflow is not being triggered.

createRequest();

function createRequest() {
//Create Request
var grRequest = new GlideRecord("sc_request");
grRequest.initialize();
//substitute your requested for
grRequest.requested_for = email.origemail;
grRequest.short_description = 'Offboarding Request';
grRequest.description = "received from: " + email.origemail + "\n\n" + email.body_text;
var requestSysId = grRequest.insert();
//Create Request Item, substitute your requested for
current.requested_for = email.origemail;
current.short_description = 'Offboarding Request';
current.variables.person_term = email.body.user;
current.variables.offboarded_on_garden_leave = 'No';
current.variables.effective_date = email.body.date;
current.description = "received from: " + email.origemail + "\n\n" + email.body_text;
//substitute your cat item
current.cat_item = 'bd7816cb98f30500ef916aeaa4e20503';
current.parent = requestSysId;
current.request = requestSysId;
current.insert();
//Workflow Trigger
//More information http://wiki.servicenow.com/index.php?title=Workflow_Script
var id = '7f783b2d1b603910b1b90f69cc4bcb13'; //sysId of my workflow

var w = new global.Workflow();
w.startFlow(id, current, current.operation());

}

gs.info("TRICIA wf " + wfSysId);

4 REPLIES 4

triciav
Kilo Sage

Also if I user the cart apii I am getting 

EMEA APAC Offboarding : did not create or update sc_req_item using current

Hello @triciav ,

Please use CartJS() API instead of Cart API as cart is outdated 

follow this link for more info on CartJS

https://developer.servicenow.com/dev.do#!/reference/api/tokyo/server/sn_sc-namespace/c_CartJSScoped#...

Hope this helps

Mark my answer correct if this helps you 

Thanks

Mind providing an example this is not helping me

CartJS is giving me did not create or update sc_req_item using current

 

var cart = new sn_sc.CartJS();
var request =
{
'sysparm_id': 'bd7816cb98f30500ef916aeaa4e20503',
'sysparm_quantity': '1',
'variables':{
'offboarded_on_garden_leave': 'No',
'person_term': email.body.user,
'effective_date': email.body.date

}
};
var cartDetails = cart.orderNow(request);
gs.info("TRICIA CART "+cartDetails);