Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Work notes list maximum 3 in quick message

ShuRiseUp2023
Tera Expert

Hi Community,

I need to create a quick message for the P1/P2 incidents to show all the work notes have been added to this incident so far. In the quick message, I use ${work_notes} to pull the variable but the maximum work notes number that listed in the quick message is 3. It always shows the latest 3 work notes of this incident. How to show all the work notes in the quick message? 

Thanks

1 ACCEPTED SOLUTION

Chaitanya ILCR
Giga Patron

Hi @ShuRiseUp2023 ,

 

1. you can set the system property value to -1

glide.email.journal.lines

ChaitanyaILCR_0-1752626812195.png

note: this would be reflecting in all over the system

 

 

2. else follow this approach 

https://www.servicenow.com/community/itsm-forum/can-we-add-mail-script-to-the-quick-message/td-p/649...

 

create a Before insert update BR on the sys_email and sys_email_draft table

 

ChaitanyaILCR_2-1752628526610.png

with script

ChaitanyaILCR_3-1752628558083.png

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    var targetRecord = new global.GlideRecordUtil().getGR(current.getValue('target_table'), current.getValue('target_record'));
    if (targetRecord.isValidRecord()) {
        current.setValue('body', current.getValue('body').replaceAll('{placeHolderWorknotes}', targetRecord.work_notes.getJournalEntry(-1)).replaceAll('\n','<br/>'));
    }


})(current, previous);

 

add the key Word {placeHolderWorknotes} in whichever the quick message you want 

The BR parses it and replaces it with the worknotes

 

ChaitanyaILCR_1-1752628478666.png

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

 

View solution in original post

6 REPLIES 6

Hi @ShuRiseUp2023 ,

 

yes, it's instance for sys_email and target_record for the sys_email_draft table

 

1 and 2 are two approaches you can follow 
I forgot to mention that 

either you can set the property to -1 

 

or 

you can go with the BR approach

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

I used the 2nd approach and created business rule on sys_email table. Thanks a lot for your help!

Don't know what to do with email draft table. there's no records in email draft table.