Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to show worknotes added by in email notification

Talari Balateja
Tera Expert

Hi,

 

I want show case worknotes in the notification along with "worknotes added by".

 

I got stucked in worknotes added by.

Table _incident

 

Regards,

Sanju

1 ACCEPTED SOLUTION

.


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

View solution in original post

9 REPLIES 9

Sohail Khilji
Kilo Patron

Hi @Talari Balateja 

 

Create a mail script and call it on your notification.

 

var rec = new GlideRecord('sys_journal_field');
rec.orderByDesc('sys_created_on');
rec.addQuery('name', current.getTableName());
rec.addQuery('element', 'work_notes');
rec.addQuery('element_id', current.sys_id);
rec.setLimit(1);
rec.query();
if(rec.next()){

template.print(rec.value);

}

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Hi @Sohail Khilji 

 

I want show highlighted name in notification

 

TalariBalateja_0-1707892269777.png

 

Hi @Talari Balateja 

 

try :

var rec = new GlideRecord('sys_journal_field');
rec.orderByDesc('sys_created_on');
rec.addQuery('name', current.getTableName());
rec.addQuery('element', 'work_notes');
rec.addQuery('element_id', current.sys_id);
rec.setLimit(1);
rec.query();
if(rec.next()){

var wrk_nts = rec.value.toString();
wrk_nts.split(' ');
var value = wrk_nts[0];

template.print(value); // this will print only the first work from the string

}

☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Hi @Sohail Khilji 

 

It's showing worknotes not the added by 

 

TalariBalateja_0-1707894371674.png

 

like I want show comments added by "manjrekar"