The CreatorCon Call for Content is officially open! Get started here.

Redirecting email notifications to Service portal approvals and surveys

bsk
Kilo Expert

Hi Every One,

We have requirements to redirect approval notification and Survey notification to service portal.

I have created email script :

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var url = '<a href="' + gs.getProperty('glide.servlet.uri') + 'sp?id=approval&&table=' + current.sys_class_name + '&sys_id=' + current.sys_id + '">Link</a>';
template.print(url);
})(current, template, email, email_action, event);

Added in notification:

Click here to view Approval Request: ${mail_script:Approval_notification} 

when user clicks on link it is redirecting to Service portal by says "Record Not found". Same case with Surveys to.PFA

find_real_file.png

Can any one suggestion me what peace i am missing in redirecting for specific record to get opened for Approvals & Surveys.

Thanks in Advance 

4 REPLIES 4

Mike Patel
Tera Sage

You have to hard code table name to table=sysapproval_approver 

${sys_class_name} it will not return the class name of the record for approval. Mostly it works on like INC,REQ,RITM,etc

Hari34
Tera Contributor

Hi ,

Please replace your code with the below code 

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var url = '<a href="' + gs.getProperty('glide.servlet.uri') + 'sp?id=approval&&table=sysapproval_approver'+ '&sys_id=' + current.sys_id + '">Link</a>';
template.print(url);
})(current, template, email, email_action, event);

Added in notification:

Click here to view Approval Request: ${mail_script:Approval_notification} 

 

how to redirect in case of survey?

Dishtiwari
Tera Contributor