- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2018 03:11 AM
We have created a notification with a link, which should point to an HR Case on the service portal /sp. I am aware of ${URI} and ${CMS_URI} for the /ess. But what is the equivalent for the Service Portal?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2018 12:17 AM
Hi
There is no equivalent for the service portal, as the path depends on they way your portal is set up (the name of the page which shows the specific record type).
But its easy to create your own mail script and refer to it in the notification.
We have a mail script called "URI_REF_SP". It looks like this
//Adds an URI_REF pointing the the Service Portal
//URL depending on current table - if an approval we will point to the approving record
//incident -> /sp?id=ticket&table=incident&sys_id=[sys_id]
//sc_req_item -> /sp?id=sc_req_item&sys_id=[sys_id]
//sc_request -> /sp?id=sc_request&sys_id=[sys_id]
//other tables point at form view -> sp?id=form&table=[table]&sys_id=[sys_id]
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var table = current.getTableName();
var url = '';
var sys_id = current.sys_id;
var number = current.number;
//If running on approval, the link must point the task being approved
if (table == 'sysapproval_approver') {
table = current.sysapproval.sys_class_name;
sys_id = current.sysapproval;
number = current.sysapproval.number;
}
if (table == 'incident')
url = "/sp?id=ticket&table=incident&sys_id=" + sys_id;
else if (table == 'sc_req_item')
url = "/sp?id=sc_req_item&sys_id=" + sys_id;
else if (table == 'sc_request')
url = "/sp?id=sc_request&sys_id=" + sys_id;
else
url = "/sp?id=form&table=" + table + "&sys_id=" + sys_id;
template.print("<a href='" + url + "'>" + number + "</a>");
})(current, template, email, email_action, event);
You call it from the notification using ${mail_script: URI_REF_SP}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2018 12:17 AM
Hi
There is no equivalent for the service portal, as the path depends on they way your portal is set up (the name of the page which shows the specific record type).
But its easy to create your own mail script and refer to it in the notification.
We have a mail script called "URI_REF_SP". It looks like this
//Adds an URI_REF pointing the the Service Portal
//URL depending on current table - if an approval we will point to the approving record
//incident -> /sp?id=ticket&table=incident&sys_id=[sys_id]
//sc_req_item -> /sp?id=sc_req_item&sys_id=[sys_id]
//sc_request -> /sp?id=sc_request&sys_id=[sys_id]
//other tables point at form view -> sp?id=form&table=[table]&sys_id=[sys_id]
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var table = current.getTableName();
var url = '';
var sys_id = current.sys_id;
var number = current.number;
//If running on approval, the link must point the task being approved
if (table == 'sysapproval_approver') {
table = current.sysapproval.sys_class_name;
sys_id = current.sysapproval;
number = current.sysapproval.number;
}
if (table == 'incident')
url = "/sp?id=ticket&table=incident&sys_id=" + sys_id;
else if (table == 'sc_req_item')
url = "/sp?id=sc_req_item&sys_id=" + sys_id;
else if (table == 'sc_request')
url = "/sp?id=sc_request&sys_id=" + sys_id;
else
url = "/sp?id=form&table=" + table + "&sys_id=" + sys_id;
template.print("<a href='" + url + "'>" + number + "</a>");
})(current, template, email, email_action, event);
You call it from the notification using ${mail_script: URI_REF_SP}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2018 06:53 AM
This is great help, thank you. Just a couple of quick corrections
1) The request and requested item URLs should be:
url = "/sp?id=sc_req_item&table=sc_req_item&&sys_id=" + sys_id;
url = "/sp?id=sc_request&table=sc_request&sys_id=" + sys_id;
2) The extra space between the mail_script and URI_REF_SP gave me a bit of trouble. Posting to help others who may run into the same issue.
{mail_script:URI_REF_SP}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2021 08:41 AM
So this works great, but I noticed that when an req_item is rejected the email send out links to sc_req_item&sysid and the page that comes up is the breakout page,
Do I just need to add a new page for this?