The CreatorCon Call for Content is officially open! Get started here.

Live notification

Deepika Ravindr
Tera Contributor
 
9 REPLIES 9

Try something as below.

Create a mail script by navigating to System Notification >> Email >> Notification Email Script and create with name: getnoteslivenotification

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

   var getworknotesis=new GlideRecord('task');
   getworknotesis.addQuery('sys_id',current.document);
   getworknotesis.query();
   if(getworknotesis.next())
   {
	   template.print('With notes as below \n\n');
	   template.print('<br>');
	   var gettextis=getworknotesis.work_notes.getJournalEntry(1).split('(Work notes)')[1];
	   template.print(gettextis);
   }

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

 Call the mail script in the notification's What it will contain tab as below

${mail_script:getnoteslivenotification}

Hi @Jaspal Singh ,

Thanks for that, It's working well, I have one more doubt, how can I display the latest three work notes in that notification?

Thanks,

Deepika

Replace

 

  var gettextis=getworknotesis.work_notes.getJournalEntry(1).split('(Work notes)')[1];

 

in the script with

 

  var gettextis=getworknotesis.work_notes.getJournalEntry(1).split('(Work notes)')[1];

 

working

You can try to load all.

var gettextis=getworknotesis.work_notes.getJournalEntry(-1).split('(Work notes)')[1];