Inbound email action is not triggering

siva44
Tera Contributor

I have created inbound action for create catalog request but it showing error is below:

" did not create or update sc_req_item using current"

 

I am also put the catalog item availble for any user but still showing the above message 

inbound action script:

createRequest();
 
function createRequest() {
// setup variables
    var short_description = email.subject.toString();
var body = email.body_text.toString();
var message = "received from: " + email.origemail + "\n\n" + body;
var cat_item = '552f9d3b97'; // my catalog item sys_id
var requested_for = 'dad230de1b0b'; // Test   sys_id
 
var cart = new sn_sc.CartJS();
var item =
{
'sysparm_id': cat_item,
'sysparm_quantity': '1',
'variables': {
'requested_for': requested_for,
'role_name':message,
'role_description':short_description,
'purpose_for_access_being_requested':message,
' additional_information':message
}
};
cart.addToCart(item);
 
var request =
{
  'special_instructions' : '',
  'requested_for' : requested_for,
  'delivery_address' : '',
};
// Place order from cart
var requestDetails = cart.submitOrder(request);
 
// update details in the Requested Item
// pull out the Request Sys ID from the order
var reqSysID = requestDetails.request_id;
 
// update the RITM to have a short description from the email
var rec = new GlideRecord("sc_req_item");
rec.addQuery("request", reqSysID);
rec.query();
// check for a record
if (rec.next()) {
// get the RITM, should be the only item with this parent
rec.short_description = short_description;
rec.update();
}
}

 

4 REPLIES 4

Simon Christens
Kilo Sage

Can you verify that everything works as expected?

Because when receiving an email ServiceNow checks for current.insert() or current.update() which doesnt happens - of good reasons.

So i wouldnt expect the log to show insert or update in this particular case.

siva44
Tera Contributor

Hai @Simon Christens 

I hope Everything is fine but where is it my mistake i don't know can u verify the script 

 

siva44
Tera Contributor

Hi @Simon Christens  

I have checked RITM table request was created successfully but have u know any idea for that log message and also in email message that is showing target field is empty

Hi again,

Yes the log says "dud not create or update using current" meaning that you do not use current.update() or current.insert().

That does not mean that the inbound doesnt work - it just says that it doesnt create or update using current.

So as stated before - the inbound action probably work as intended if it creates what you expect