Can we pass event param to email notification link

Hari1
Mega Sage

Hi,

I have a scheduled job which has some values. I need to bind a particular value to the notification link from the scheduled job so that i can set that value on the catalog form field.

What is the process i am doing?

1. I have created a scheduled job.

2. I am passing the value through an event param

gs.eventQueue('abc_event_name','','22.2'); //22.2 is the value that needs to binded on the notification link

3. I have added event param on the link so that i can access this through an onload client script.

https://abc.service-now.com/sp?id=sc_cat_item&sys_id=84d952014f43012361ab123df699xyz9&iteration={event.parm1}

I don't see the event param on the url when i click on the email notification link.

find_real_file.png

Thanks.

1 ACCEPTED SOLUTION

Aman Kumar S
Kilo Patron

Hey,

It is possible to pass.

Few things to check:

1. For event queue function, can you pass object as 2nd parameter and if you don't want to pass any additional parameter, keep it as "", but have 4 parameters

2. The notification should be the same table as the Event

3. For building the URL are you doing it in email script or notification?

If notification, do the following:

https://abc.service-now.com/sp?id=sc_cat_item&sys_id=84d952014f43012361ab123df699xyz9&iteration=${event.parm1}

If email script

"https://abc.service-now.com/sp?id=sc_cat_item&sys_id=84d952014f43012361ab123df699xyz9&iteration= "+ event.parm1

Best Regards
Aman Kumar

View solution in original post

6 REPLIES 6

Aman Kumar S
Kilo Patron

Hey,

It is possible to pass.

Few things to check:

1. For event queue function, can you pass object as 2nd parameter and if you don't want to pass any additional parameter, keep it as "", but have 4 parameters

2. The notification should be the same table as the Event

3. For building the URL are you doing it in email script or notification?

If notification, do the following:

https://abc.service-now.com/sp?id=sc_cat_item&sys_id=84d952014f43012361ab123df699xyz9&iteration=${event.parm1}

If email script

"https://abc.service-now.com/sp?id=sc_cat_item&sys_id=84d952014f43012361ab123df699xyz9&iteration= "+ event.parm1

Best Regards
Aman Kumar

Yes i did try and it displays as blank. Below is what i see through a notification.

https://abc.service-now.com/sp?id=sc_cat_item&sys_id=84d952014f43012361ab123df699xyz9&iteration=

How to achieve this using an email script?

1. Create a "Notification email script" through app nav

2. Click New, give it a name  for eg "get_url"

3. if you are planning to pass an URL, just write in script section:

var urlString = "https://abc.service-now.com/sp?id=sc_cat_item&sys_id=84d952014f43012361ab123df699xyz9&iteration= "+ event.parm1;

template.print(urlString);

4. Go to your notification and embed this email script:

${mail_script:script name}

Ref article:

https://docs.servicenow.com/bundle/quebec-servicenow-platform/page/script/server-scripting/concept/c_ScriptingForEmailNotifications.html

https://docs.servicenow.com/bundle/quebec-servicenow-platform/page/script/server-scripting/reference/r_ExScptEmlNtfn.html

Best Regards
Aman Kumar

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

can you share how you are including?

it should be like this i.e. $

find_real_file.png

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader