inbound action not creating request / "did not create or update sc_req_item"

heidiyablonski
Tera Contributor

I created an inbound action to create a request/RITM/Task.   The condition is met and the rule fires but fails with message "did not create or update sc_req_item".   The target table is sc_req_item, action type is Record Action.   The "When to Run" condition is being met and triggering the rule.

This is my script:

createRequest();

function createRequest() {

//Get Requested For

var usr = new GlideRecord('sys_id');

usr.addQuery('user_name',email.body.username.toString());

usr.addActiveQuery();

usr.query();

if(usr.next() && email.body.comments.toString())

  {

  var grRequest = new GlideRecord ("sc_req_item");

  grRequest.initialize();

  grRequest.requested_for = usr.sys_id;

  grRequest.short_description = email.body.url.toString();

  grRequest.description = "received from: " + email.origemail + "\n\n" + email.body_text;

  var requestSysId = grRequest.insert();

  //Create Request Item

  current.requested_for = usr.sys_id;

  current.short_description = email.body.url.toString();

  current.description = "received from: " + email.origemail + "\n\n" + email.body_text;

  current.cat_item = '9ad82be3db448740c03a77e9af96196a';

  current.parent = requestSysId;

  current.request = requestSysId;

  current.insert();

}

}

When I look at the email log from the failed request   creation, it shows as: Skipping {My Rule Name}, did not create or update sc_req_item

Does anyone have any idea what I might need to change so this works correctly?

Any assistance is greatly appreciated

Thanks,

Heidi

5 REPLIES 5

Stefan Baldhof1
Kilo Guru

Hello Heidi,



just by the way: are you really doing a GlideRecord query on "sys_id" like written in your code:



        var usr = new GlideRecord('sys_id');



This will definitely not work  



Regards,


Stefan