- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2018 12:02 PM
I've updated an email template, however just not showing the links/message. Not sure what I am missing here. The notification fires when a comment is made on the request table and is sent to the 'request for'. I have a mail script to identify is the request for is an internal user or not and handle accordingly.
Short description: ${short_description}
Item: ${cat_item}
</br>
<mail_script>
var internal = current.Request.Requested for.u_internal_user;
function(){
if (internal != 'No') {
return 'To view Request: ${URI_REF}';
}
else if (internal == 'No') {
return 'To view Request: <a href="' + gs.getProperty('glide.servlet.uri') + 'msp/' + '">Click Here</a>';
}
}
template.print();
</mail_script>
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2018 11:24 AM
Great! Yeah so variables in email scripts are scoped to the individual script. You don't have a 'internal' variable defined in the second email script block, and it looks like there is an extra unmatched }, and some mismatched quotations so it fails.
You can also use a try catch block to display the error like this.
<mail_script>
try{
if (internal != 'No') {
template.print('To view Request (this is SSO): ${URI_REF}');
} else if (internal == 'No') {
template.print('To view Request (this is MSP): <a href="PORTAL URL HERE">Click Here</a>');
}else template.print('To view Request (this is else SSO): ${URI_REF}');
} catch(err){
template.print('An error occurred - '+err.message);
}
</mail_script>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2018 11:24 AM
Great! Yeah so variables in email scripts are scoped to the individual script. You don't have a 'internal' variable defined in the second email script block, and it looks like there is an extra unmatched }, and some mismatched quotations so it fails.
You can also use a try catch block to display the error like this.
<mail_script>
try{
if (internal != 'No') {
template.print('To view Request (this is SSO): ${URI_REF}');
} else if (internal == 'No') {
template.print('To view Request (this is MSP): <a href="PORTAL URL HERE">Click Here</a>');
}else template.print('To view Request (this is else SSO): ${URI_REF}');
} catch(err){
template.print('An error occurred - '+err.message);
}
</mail_script>