- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2020 10:25 AM
Evening all,
I am working on an inbound action which is behaving rather odd. it is meant to fire a specific cat item, log as the person emailing in and take the subject and body as short description and description. At the moment the inbound action states it is being skipped but a the request again the ritm is being generated, logging as the person sending in the email, the short description is not mapping but description IS the body of the email
Any thoughts on why the inbound action is stating it skipped when it logged? the error on the email logs is
create cat request : did not create or update sc_request using current |
My inbound action script is below
createRequest();
function createRequest() {
var cart = new Cart(); //calling the cart API
var item = cart.addItem('4c1398342f302010f2aee36ef699b6f5'); //sys_id of the catalog item I want to fire
cart.setVariable(item, 'subject', email.subject); //sets catalog variable to the email's subject
cart.setVariable(item, 'emailbody', email.body_html); //sets catalog variable to email's body
var rc = cart.placeOrder(); //this launches the catalog item, and creates a request object. rc = the request object
updateRITM(rc.sys_id); //call a function immediately to update the ritm. This must be a nested function, otherwise inbound actions get weird.
//also, we're passing the sys_id of the request so we know what RITM to grab.
}
function updateRITM(req){
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('request', req); //req is what we passed from the previous function. the sys_id of the request.
ritm.query();
while (ritm.next()){
ritm.u_customer = gs.getUserID(); //my ritm table separately tracks its own customer, since I don't use Request
ritm.description = email.body_text; //we're still in the inbound action so why not exploit?
ritm.priority = email.body.priority; //good example of how to exploit email body variables
ritm.update();
}
}
event.state="stop_processing"; //stop evaluating inbound actions. This is why I keep this record's order lower than my incident from email rules.
Solved! Go to Solution.
- Labels:
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2020 07:31 AM
Thanks for all the help Kieran
This is working end to end in my PDI. I have moved the update set in the proper dev instance and its no longer working. The cat item and inbound action has come in, I have checked the sys ids that are in the inbound action script and checked all other conditions, the inbound email It gives me the same message against the UI Action as in my instance
my-inbound - action - name : did not create or update sc_request using current
In the PDI instance it logs the req with the req_item but in dev it does nothing.
Is there a setting, property etc that I need to look at? I have created the inbound action and cat item from scratch (And update the sys Ids) but still the same response
JAck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2020 10:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2020 10:49 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2020 11:39 AM
Hi,
This doesn't indicate that the inbound action was skipped, only that the "current" object which is established by the inbound action wasn't used. This is correct as your script is doing it's own record creation using the Cart() api.
You can't get rid of this error, but you can tidy up your email processing by using the following script:
(function runAction( /*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
//Try / Catch to log any errors to email processing
try{
//Use new name-space API for creating an REQ.
var cart = new sn_sc.CartJS();
var item = {
'sysparm_id': '4c1398342f302010f2aee36ef699b6f5',
'sysparm_quantity': '1',
'variables': {
'subject': email.subject,
'emailbody' : emai.body_html
}
};
var cartDetails = cart.orderNow(item);
logger.log(JSON.stringify(cartDetails));
//Set the email record values to the record we created. This allows for the email to show on the activity stream.
sys_email.target_table = cartDetails.table;
sys_email.instance = cartDetails.request_id;
} catch (e){
//Log a warning to email processing logs.
logger.logWarning(e);
}
})(current, event, email, logger, classifier);
You'll still see the "did not create or update" information message in the logs, but the above sys_email additions mean that the email is correctly mapped to the target record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2020 06:19 AM
Hey Kieran
That makes a lot of sense and I now have most of it mapping, I am not getting the initial email showing in the activities filtered even though sent/received emails is added and ticked and attachments are not pulling through, I thought both are OOTB functionality?
Jack