Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

using email address in Event Parm1 not working

jmcagod
Kilo Guru

Hi guys

I'm trying to create a bounce back notification to the user whenever they attempt to create a ticket via email.

On the existing Inbound Email, I triggered an event:

gs.eventQueue("create_ticket",current,email.origemail,"");

Parm1 - email address of the sender/requestor

Parm2 - empty, I just need one email.

The event perfectly works.

Going to notifications, I tried couple options to make it work:

1. Clicking Event Parm1 contains recipient. - did not work (Base on the forms that I read, you need   the user sys_id?)

2. Creating email script where:

       

        var requestor = even.parm1;

        email.setReplyto(requestor);

        var email_body = "This is a bounce back email notification";

        template.print(email_body);

        Still not working.

Am I missing something on the script? Can this be done using an event?

Thanks,

9 REPLIES 9

drjohnchun
Tera Guru

Just curious why you'd want to create an email this way. When a new ticket is created, doesn't that action trigger a notification email to the user?



Hope this helps.



Please feel free to connect, follow, mark helpful / answer, like, endorse.


John Chun, PhD PMP see John's LinkedIn profile

visit snowaid


ServiceNow Advocate

Winner of November 2016 Members' Choice Award


jmcagod
Kilo Guru

Our client wants to disable the creation of ticket via email (Before, users can create ticket by sending an email).



What I did is I updated the Inbound email, and when someone tries to create one by sending email, they will receive a bounce back email saying "You cannot create ticket through email, we advise you to use service portal" something like that.


email.setReplyTo() method does not work at all. And coming to the event parameter, you can either use sys_id of the user record or email address. Go to the event log and search for your event and   see what you get in parm1


Ah, makes perfect sense now.



For Parm1, I'd pass the Sys ID of the user using the gs.getUserID() method from your Inbound Action, so you don't have to set the recipient's email address in your Notification.