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 @SatyakiBose  ,

 

Thanks for the response.

 

I have written the email script like below.

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

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

 

And I have created the Notification like below.

${mail_script:listofautomationcases}

Dear Assigned to: ${assigned_to},
Your Case has been opened: Number: ${number}.
Your list of Automation Cases is accessible here url.
---This is automated alert mail from automated mailbox, please do not answer ---


Best Regards
Automations.

 

I have called the email script in the notification like above, How do I place the URL in the list of automation cases above in the notification, Also, do I need to create an event and BR to trigger this. Could you please guide me .

 

Thanks so much,

Nagashree.

Hi @SatyakiBose ,

Thanks for the response.

I have written the email script like below.

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

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

Hi,

Thanks for the response. I have used the above same code and wrote a email script and I have created the Notification like below.

${mail_script:listofautomationcases}

Dear Assigned to: ${assigned_to},
Your Case has been opened: Number: ${number}.
Your list of Automation Cases is accessible here url.
---This is automated alert mail from automated mailbox, please do not answer ---

Best Regards
Automations.

I have called the email script in the notification like above, How do I place the URL in the list of automation cases above in the notification, Also, do I need to create an event and BR to trigger this. Could you please guide me .

Thanks so much,

Amarjeet Pal
Kilo Sage
Kilo Sage

Hello @Nagashree5 ,

To Complete this Post , Please use the notification script in your notification 

You need to call the notification script : ${mail_script:script name}

 

This will work then.

 

Thanks

Hi @SatyakiBose / @Amarjeet Pal 

 

Thanks for the response.

 

I have written the email script like below.

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

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

 

And I have created the Notification like below.

${mail_script:listofautomationcases}

Dear Assigned to: ${assigned_to},
Your Case has been opened: Number: ${number}.
Your list of Automation Cases is accessible here url.
---This is automated alert mail from automated mailbox, please do not answer ---


Best Regards
Automations.

 

I have called the email script in the notification like above, How do I place the URL in the list of automation cases above in the notification, Also, do I need to create an event and BR to trigger this. Could you please guide me .

 

Thanks so much,

Nagashree.