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

How to add work notes detail under provider notification

AkashL722774083
Tera Contributor

AkashL722774083_1-1759157007720.png

 

I am working on a provider notification that is triggered when a user is mentioned in the work notes. The notification is sent to the mentioned user.

My goal is to include the content of the work notes in this notification. However, I've noticed that the notification record is created on the live_notification table, and there doesn't seem to be a direct variable to access the work notes content.

Is there a way to access the work notes from the live_notification table for my notification?

 

6 REPLIES 6

RaghavSh
Kilo Patron

@AkashL722774083 The document ID can give you the record sys_id and record table.

 

You will probably need email script to glide the record table and get the latest journal entry using:

gr.comments.getJournalEntry(-1);


Please mark the answer correct/helpful accordingly.


Raghav
MVP 2023
LinkedIn

Thanks for your response. Does a Provider Notification allow the use of an email script? I tried adding an email script in a Provider Notification, but the notification doesn’t get triggered. When I remove the email script, it works fine.

@AkashL722774083 can you share the code?


Raghav
MVP 2023
LinkedIn

var gr = new GlideRecord('sys_journal_field');
        gr.addQuery('element_id', result.recordSysId);
        gr.addQuery('element', 'work_notes');
        gr.orderByDesc('sys_created_on');
        gr.setLimit(1);
        gr.query();
        if (gr.next()) {
            var workNotes = gr.getValue('value');
            if (workNotes) {
                template.print("<p style='color: #424E5B;margin: 0 0 12px;line-height: 26px;margin-bottom: 12px'><strong>Latest Work Note:</strong><br/>" + workNotes + "</p>");
            }
        }