- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2020 02:37 AM
Hi All,
I have created a notification on user table so when a new user is created it should trigger notification to a department head to add few more details and i have provided the link in the notification that link will redirect to service portal and opens a catalog item. But i want to add it dynamically when we move the code to different intance also it should work.
Notification detalis
When to send : Record Inserted
Who will recieve : department head
What it will contain: http://details.about.thelink. It will resirect to portal.
Please suggest how can i achieve this.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2020 02:42 AM
Hi Tejaswini,
You can simply pass it as below.
Where sp is my portal name & sys_id is sys_id of item which ideally will be same across instances thus making it dynamic

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2020 02:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2020 03:15 AM
Hi Jaspal.
In mail script what i need to write?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2020 03:23 AM
Hi Tejaswini,
If you use above there is no need to pass or use any mail script as if you closely look we are not pasing the instance name as hard-coded values.
If you will to go with mail script approach you can use below in your mail script.
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
template.print('<a href="https://' + gs.getProperty('instance_name') + '.service-now.com/sp?id=sc_cat_item&sys_id=039c516237b1300054b6a3549dbe5dfc" target="_blank">' + Click Here + '</a>');
})(current, template, email, email_action, event);
Call the mail script in notifiation body in format.
${mail_script:yourmailscriptname}
Replace yourmailscriptname with correct name of mail script you created with above code.
Note: Assuming the sys_id of item where you want to direct post link click is same across instances. You need to replace that as well in code above.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 01:45 PM
Does this work even if the user clicks a link in a 3rd party email client?