How to add a table in email notification in workflow?

swathigangadhar
Tera Expert

I want to send an email which has a table in it,

Like Sl.no task                             description

                  1         TASK001             abcd

                  2         TASK002             xyz

How can i achieve this?

1 ACCEPTED SOLUTION

Hello Swathi,



It's my mistake that I didn't give attention that you needed it via workflow.


So, in that case my suggestion would be, creating a new event from the registry and add an Event activity in the workflow and provide the name of the Event there.



find_real_file.png



After that, from the Email->create a Notification and trigger it when the event is fired with the particular event name.


Like,


find_real_file.png



And, in the Notification body, you can include which I posted previously:



find_real_file.png



Also, you can specify the recipients from here itself.



I hope this would solve your requirement more easily rather writing a long piece of mail script and then including it in the mail body.



Please hit Like or mark Helpful or Correct based on the impact.


Thanks,


Rajshekhar Paul


View solution in original post

12 REPLIES 12

If you need static data, then you dont require any scripting.



Just add a table in the HTML Message editor of notification and add the required content in each of its cell.



Thank You


Please Hit Like, Helpful or Correct depending on the impact of response


in workflow notification there is no HTML editor.


Hi Swathi,



In workflow in email notification activity you can add the code within <mail_script> tag


<mail_script>


template.print('<tr>');


  template.print('<th>Sr No</th>');


  template.print('<th>Task</th>');


  template.print('<th>Description</th>');


  template.print('</tr>');



template.print('<tr>');


  template.print('<td>1</td>');


  template.print('<td>TASK001</td>');


  template.print('<td>abcd</td>');


  template.print('</tr>');



template.print('<tr>');


  template.print('<td>2</td>');


  template.print('<td>TASK002</td>');


  template.print('<td>xyz</td>');


  template.print('</tr>');


</mail_script>



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Rajshekhar Pau1
Kilo Guru

Hello Swathi,



Please follow the below step to print a table on the email body:


find_real_file.png



find_real_file.png



Hope this helps.


Please hit Like or mark Helpful or Correct based on the impact.



Thanks,


Rajshekhar Paul


Hi Rajshekhar,



This would work when email notification is being used. But Swathi is using workflow email notification activity so this cannot be used


Any way this will work for when email notification is used.



Regards


Ankur


Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader