How to trigger "event" from inbound action to trigger notification to the email.from user?

Fathima6
Tera Expert

Hi all,

 

I having one inbound action to update additional comments of the incident tickets from the 3rd party email's body text based on the incident number in the email's subject. So the next step is to reply to the "email's from" once incident updated successfully. I am trying to trigger the event from inbound action. but it's not working as expected.

   script included after update record is:  gs.eventQueue("Hi_incident", current.email.from, msg);

find_real_file.png

find_real_file.png

find_real_file.png

find_real_file.png

 

Please help me to come out of it.

 

Thanks in advance

 

5 REPLIES 5

Ajaykumar1
Tera Guru

Hi Fathima,

As per my understanding, if you want to send email after an Incident record is updated, then the table name should be "incident" in event registry, notification/inbound action.

Also, "script included after update record is:  gs.eventQueue("Hi_incident", current.email.from, msg);" --- where it is written...? In a business rule or inside Inbound action ?

 

If gs.eventQueue("Hi_incident", current.email.from, msg); is in Inbound action, edit it as 

gs.eventQueue("Hi_incident", current,email.from, msg);//or email.origemail if email.from fails

Thanks,

Ajay

@Ajaykumar 

Thanks for your response:)

What should I have to give in user field in notification? I have to send notification to the user who send email. How can I get the email.from user in notification?

find_real_file.png

Fathima6
Tera Expert

@ajaykumar 

 

Hi Its again not working:(

FYR

This is my code in inbound action:

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

 

gs.include('validators');

 

if (current.getTableName() == "incident")

 

{

 

//This gets you the INC number similar code can be used to get the ref number in your case.

 

var numberPattern = "/CS\[0-9]{7}/i"; //Looking for INC plus 0-9 numbers, seven numbers in total. ignores case

 

var reg = new SNC.Regex(numberPattern);

 

var caseNumber = reg.match(email.subject);

 

gs.log(caseNumber, 'test');

 

 

 

var gr = new GlideRecord('incident');

 

gr.addQuery('u_vendor_reference', caseNumber);

 

gr.query();

 

 

 

while (gr.next())

 

{

 

gr.description = email.body_text;

 

gr.update();
gs.eventQueue("Hi_incident",gr,email.origemail,msg);

event.state = "stop_processing";

}

 

}


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

 

2.This is event registry:

find_real_file.png

3.This is my notification :

 

find_real_file.png

 

 

find_real_file.pngfind_real_file.png

Fathima6
Tera Expert

@Abhinay Erra @Ajaykumar 

My event is not calling from inbound action, please help me

My inbound action script:

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

 

gs.include('validators');

 

if (current.getTableName() == "incident")

 

{

 

//This gets you the INC number similar code can be used to get the ref number in your case.

 

var numberPattern = "/CS\[0-9]{7}/i"; //Looking for INC plus 0-9 numbers, seven numbers in total. ignores case

 

var reg = new SNC.Regex(numberPattern);

 

var caseNumber = reg.match(email.subject);

 

gs.log(caseNumber, 'test');

 

 

 

var gr = new GlideRecord('incident');

 

gr.addQuery('u_vendor_reference', caseNumber);

 

gr.query();

 

 

 

while (gr.next())

 

{

 

gr.description = email.body_text;

 

gr.update();

gs.eventQueue("Hi_incident", gr, email.origemail, msg);
event.state = "stop_processing";

}


}

 


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

Event Log:

find_real_file.png