Inbound Action: updating incident

kemmy1
Tera Guru

I've gone through (I think) ALL of the docs and community posts about this, but for some reason this is not working for me.  This is a "New" inbound action (no watermarks)

An email is sent (no watermark) with the Incident number to update in the body of the email.  I've tried a couple of ways to update the Incident and it's not working:

This doesn't do anything:
(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
var id = email.body.email_incident;
var inc = new GlideRecord('incident');
inc.addQuery('number', id);
inc.query();
if(inc.next()) {
inc.work_notes = "this is a comment3333";
inc.update();
}

})(current, event, email, logger, classifier);
-------------------------------------------------------

This creates a new incident not updates it:
(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
var id = email.body.email_incident;
var inc = new GlideRecord('incident');
inc.addQuery('number', id);
inc.query();
if(inc.next()) {
inc.work_notes = "this is a comment3333";
current.update();
}
})(current, event, email, logger, classifier);

------------------------------------------------------------

I created a log and email.body.email_incident does pull out the correct incident number, so it IS finding the incident number (I also used a background script to make sure it finds the record as well).

Any ideas?

Lisa

 

1 ACCEPTED SOLUTION

SanjivMeher
Kilo Patron
Kilo Patron

Hi Lisa,

Is this the complete code? I don't see a reason this to be not working. Are you sure, the email is entering your inbound action. Please some logs to it, to make sure it does

 

gs.info('+++++inside my inbound action+++++'+email.body.email_incident)

var id = email.body.email_incident;
var inc = new GlideRecord('incident');
inc.addQuery('number', id);
inc.query();
if(inc.next()) {
inc.description = "this is a comment3333";
inc.update();

}


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

6 REPLIES 6

SanjivMeher
Kilo Patron
Kilo Patron

Hi Lisa,

Is this the complete code? I don't see a reason this to be not working. Are you sure, the email is entering your inbound action. Please some logs to it, to make sure it does

 

gs.info('+++++inside my inbound action+++++'+email.body.email_incident)

var id = email.body.email_incident;
var inc = new GlideRecord('incident');
inc.addQuery('number', id);
inc.query();
if(inc.next()) {
inc.description = "this is a comment3333";
inc.update();

}


Please mark this response as correct or helpful if it assisted you with your question.

Yes, the email_incident is definitely coming through.  I did a gs.log("LAK " + id).

Here is my complete code (I updated my original question as well):

(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {

var id = email.body.email_incident;

var inc = new GlideRecord('incident');
inc.addQuery('number', id);
inc.query();
if(inc.next()) {
inc.work_notes = "this is a comment3333";
current.update();
}


})(current, event, email, logger, classifier);

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

What is the type of this inbound email action?


New, Forward or Reply or none?

Thanks,
Ashutosh

It's new and there is no watermark.  Forgot to add that!