insert work notes into email notification

TMKAM
Tera Contributor

Here is my scenario.

 

Scenario 

I have 4 TASK ticket created.

1. TASK 1 ticket open to Team A and state set as Close Complete.

2. TASK 2 ticket open to Team B and state set as Close Complete.

3. TASK 3 ticket open to Team A and before state set as Close Incomplete, Team A must put work notes comment TASK 3 ticket.

4. Team B receive email notification including Work Notes comment from Team A when TASK 2 ticket reopen.

5. Team B before set state as Close Complete, Team B must put work notes comment TASK 2 ticket.

6. Team A receive email notification including Work Notes comment from Team B when TASK 3 ticket reopen.

7. Team B set state as Close Complete for TASK 3 ticket.

8. TASK 4 ticket open to Team B and state set as Close Complete.

 

I would like to get your solution or idea how to implement work notes comment insert to email notification.

Thank You

5 REPLIES 5

SatyakiBose
Mega Sage

Hello @TMKAM 

Capturing any work notes or comments from a task record is pretty simple.

When you design the notification, under the What it will contain section you will have the fields of the form.

You can simply add the Additional Comments and the Work Notes of the field.

SatyakiBose_0-1676526030482.png

SatyakiBose_1-1676526058394.png

Am assuming that you should be having some relation between the tasks here.

Now, for point 4, there should be some reference field on Task 2 where you should capture Team B details.

Once that is done, you should be able to configure a simple email notification.

Similarly for point 6.

  • Therefore looking at this, the task form should be having 2 reference field, to the sys_user_group table.
  • Lets say Field 1 is for the original assignment group for the task, and Field 2 is the group that needs to be notified.
  • When setting the email notification, under the Who will receive section, selec the Users/Groups in fields field, and add Field 2 here.

Dear SatyakiBose,

Thank you for your solution and below are the configuration and below are my test result

1. Task 1 open to Team A and close complete.

2. Task 2 open to Team B and close complete.

3. Task 3 open to Team A and add work notes and set as close incomplete

4. Email send to Team B and Task 2 reopen but no work notes information in the email from Team A.

 

Email notification configuration

TMKAM_13-1676527695335.png

TMKAM_14-1676527750976.pngTMKAM_15-1676527801456.png

Email receive from Team B to Team A with Task 2 ticket but no work notes information in the email content.

TMKAM_16-1676528093758.png

I hope the above email configuration is correct.

Regards,

TMKam

 

 

Hello @TMKAM 

Write a notification script as below:

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {

template.print('<br/>');
template.print('<font size="3" color="#000000" face="arial">');	
template.print('<b>Work Notes:</b><br/><br/>');
template.print(current.work_notes.getJournalEntry(-1));
template.print('</font>');

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

A value of -1 includes all journal entries for the work notes field.

You can change it to value such as '1', which will include only the latest work notes.

Add this notification script in the email notification body content and see how it works.

Dear SatyakiBose,

Thank you for the scripts but im a bit noob here where im not sure what should I fill on the below scripts.

 

"(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {"

Could you guide me? Thank you

REgards,

TMKam