Inbound Action WF is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2023 06:34 AM
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2023 06:39 AM
Also if I user the cart apii I am getting
EMEA APAC Offboarding : did not create or update sc_req_item using current
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2023 07:46 AM - edited ‎08-16-2023 07:49 AM
Hello @triciav ,
Please use CartJS() API instead of Cart API as cart is outdated
follow this link for more info on CartJS
Hope this helps
Mark my answer correct if this helps you
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2023 11:10 AM
Mind providing an example this is not helping me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2023 11:58 AM
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);