Show the list of incidents raised in the Notification

Nagashree5
Tera Contributor

Hi All,

 

Requirement : A notification needs to be triggered when ever a automation case gets created, this table is a custom table which extends the task table and it should be below format.

Dear Requestor,

Your Case has been opened: <Automation number>.

Your list of Automation Cases is accessible here <link>.

---This is automated alert mail from automated mailbox, please do not answer ---

Best Regards
Automations.

Here in the notification, I have to provide a link which have the list of Automation cases raised for that particular user (requested for should be that user). I'm not sure how to achieve this. Can anyone please guide me on this.

 

Thanks in Advance,

Nagashree.

1 ACCEPTED SOLUTION

SatyakiBose
Mega Sage

Hello @Nagashree5 

To make a clickable hyperlink via a notification script, refer to the example below:

sample notification script:

(function runMailScript(current, template, email, email_action, event) {
	
	// Build the link format
	var attachLink = '<a href=/sp?id=ticket&sys_id=' + current.sys_id;
	attachLink += '&table=' + current.getRecordClassName();
	attachLink += '>Portal</a>';
	
	// Print the link text
	template.print(attachLink);
	
})(current, template, email, email_action, event);

And yes. Triggering the email when the event is fired is the best approach in such scenarios.

 

View solution in original post

17 REPLIES 17

Hi @Nagashree5 

attachLink should be configured in the notification script and not the notification.

 

Hi @SatyakiBose ,

Thanks for the response, I have created the email script and called that in Notification. The hyper link is working but it is taking to the case that is been created, But here, the hyperlink should be the list of cases where the user is requested for. Suppose I have 5 cases requested for on my name, then the list 5 cases needs to be visible through the hyper link. 

I'm not sure how to achieve this. Could you please guide me.

 

Thanks in Advance,

Nagashree.

 

A sample notification script to render a list of record is as:

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var sid = SYS_ID_OF_A_GROUP;
var url = gs.getProperty('glide.servlet.uri') + 'incident_list.do?sysparm_query=active=true^assignment_group=' + sid;
template.print(url + "<br />");

})(current, template, email, email_action, event);

Make sure to add the href parameters to make this a clickable link.