- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2018 02:18 AM
Hi,
I have a link that is inputted by the HR manager to indicate the URL of a induction handbook. When a new starter process is invoked.
I want this to appear as a link in the email notification along side the blurb if a link has been added on the welcome email.
Following is as far as i got on the email notification script, but my scripting is weak and need a little help here.
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event)
{
var url = '';
var reqItm = new GlideRecord('sc_req_item');
reqItm.get(event.parm2);
if(reqItm.variables.url != ''){
template.print ("Please follow this link to access your Induction Handbook." );
template.print (reqItm.variables.url);
}
else{
url = '';
}
})(current, template, email, email_action, event);
This gives me the following:
But I cant get the space between the handbook and https, and also i cant get the https part to appear as a link.
.........
Please follow this link to access your Induction Handbook.https://yyyyyyyy.com/ABC/Support
......
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2018 02:26 AM
Hi ubaid,
I haven't tested but I believe the below should work, you need to process HTML along with the plain text.
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event)
{
var url = '';
var reqItm = new GlideRecord('sc_req_item');
reqItm.get(event.parm2);
if(reqItm.variables.url != ''){
template.print ("Please follow this link to access your Induction Handbook." );
template.print('<br/>')
template.print ('<a href="' + reqItm.variables.url + '"></href>');
}
else{
url = '';
}
})(current, template, email, email_action, event);
Kind regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2018 02:26 AM
Hi ubaid,
I haven't tested but I believe the below should work, you need to process HTML along with the plain text.
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event)
{
var url = '';
var reqItm = new GlideRecord('sc_req_item');
reqItm.get(event.parm2);
if(reqItm.variables.url != ''){
template.print ("Please follow this link to access your Induction Handbook." );
template.print('<br/>')
template.print ('<a href="' + reqItm.variables.url + '"></href>');
}
else{
url = '';
}
})(current, template, email, email_action, event);
Kind regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2018 03:25 AM
Thanks Chris,
That did the trick. Adding a semicolon after <br/> and also adding a link text so it does not make any other text in the notification following the script the link.
Many Thanks.
I did need to modify slight.
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event)
{
var url = '';
var reqItm = new GlideRecord('sc_req_item');
reqItm.get(event.parm2);
if(reqItm.variables.url != ''){
template.print ("Please follow this link to access your Induction Handbook." );
template.print('<br/>');
template.print ('<a href="' + reqItm.variables.url + '">Click here to view magazine</href>');
}
else{
url = '';
}
})(current, template, email, email_action, event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2018 02:28 AM