How to get parm2 value in the Notification?

vennela2
Tera Contributor

Hi All,

I am triggering event from server script in a widget. I am passing some value in parm2. Now I need to get that parm2 value as a part of my email notification body.

How can I get that? Please help anyone.

One more thing is I have two template.print() in my mail script. I have two different values. I need those two values in my notification. 

//below is my mail script

var test = new GlideRecord("test");
test.addQuery('name', 'true');
test.query();
if (test.next()) {
template.print(test.getDisplayValue("number"));
template.print(test.getDisplayValue("date"));

}

//below is my notification body

name: ${mail_script:getname}

below is date:

date: ${mail_script:getname}

Now I am calling my mail script two times in notification. So in the name I need first template.print() value and in the date I need second template.print() value.

How can I get that? Please help.

 

1 ACCEPTED SOLUTION

Mike Patel
Tera Sage

var parm = event.parm2;

use parm where you want to in EMail script 

if you want to use directly on notification then use ${event.parm2}

View solution in original post

4 REPLIES 4

Mike Patel
Tera Sage

var parm = event.parm2;

use parm where you want to in EMail script 

if you want to use directly on notification then use ${event.parm2}

Anil Shewale
Mega Guru

Hi vennela

You should be able to use ${event.parm2} to get whatever is captured in your parameter2 from your event.

refer  the following thread it similar

https://community.servicenow.com/community?id=community_question&sys_id=f6d7c32ddb1cdbc01dcaf3231f96...

https://community.servicenow.com/community?id=community_question&sys_id=37b1cf69db98dbc01dcaf3231f96...

 

If it help mark helpful or correct 

Thanks and regards

Anil

Allen Andreas
Administrator
Administrator

Hello,

The mail script when called, calls ALL template.print() within.

So you'd want to format that one mail script to account for either the entire message...or...make another mail script for the next line.

As far as how to use parm2, see Mike's response above.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi,

It's been a bit since my reply was posted. I just wanted to check-in and see how things are going.

If my reply helped guide you correctly, please mark it as Helpful & Correct.

Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!