Announcing the Global SNUG Board of Directors. Learn more here

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tiagomacul
Mega Sage
Mega Sage

How to add a change task table in change email notification in workflow?

 

ImageDescription
find_real_file.png01. Go to >> System Notification > Notification Email Scripts
find_real_file.png02. New
find_real_file.png03. Type a name
find_real_file.png

04. Type script following the sample code above

using the ordinary GlideRecord and creating a HML table.

 

05. On the notification you need to use a sample code, using the format

${mail_script:<scriptname>}

 

${mail_script:type_the_script_name}

 

Script

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
	
	var vchange = current.sys_id;
	
	var vtask = new GlideRecord('change_task');
	vtask.addQuery('change_request',vchange);
	vtask.query();
	
template.print('<table border="1">');
template.print('<tbody>');
template.print('<tr>');
template.print('<td style="text-align: center; color: #ffffff; background-color: #002060;">TASK&nbsp;</td>');
template.print('<td style="text-align: center; color: #ffffff; background-color: #002060;">Assignee</td>');
template.print('<td style="text-align: center; color: #ffffff; background-color: #002060;">STATUS</td>');
template.print('<td style="text-align: center; color: #ffffff; background-color: #002060;">Close notes</td>');
template.print('</tr>');

	
	while(vtask.next()){
		
		template.print('<tr>');
		template.print('<td>'+vtask.short_description+'</td>');
		template.print('<td>'+vtask.assigned_to.name+'</td>');
		template.print('<td>'+vtask.state+'</td>');
		template.print('<td>'+vtask.close_notes+'</td>');
		template.print('</tr>');
	}
	
template.print('</tbody>');
template.print('</table>');
	
})(current, template, email, email_action, event);

image

 Summary

Governance: Technical Best Practices eBook

 
Version history
Last update:
‎10-02-2019 06:37 PM
Updated by: