get the comment in the @mention notification

ofekg
Tera Contributor

i have the notifcation sent when somone mention somone with @ in the worknotes or comments,
how to add the actual @ comment into the notification?

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@ofekg 

you can use email script for this

something like this

// Get the latest work note or comment
var journalEntry = current.comments.getJournalEntry(1); // Retrieves the latest comment
var workNoteEntry = current.work_notes.getJournalEntry(1); // Retrieves the latest work note

// Check if the latest entry contains an @ mention
var mentionComment = '';
if (journalEntry && journalEntry.indexOf('@') !== -1) {
    mentionComment = journalEntry;
} else if (workNoteEntry && workNoteEntry.indexOf('@') !== -1) {
    mentionComment = workNoteEntry;
}

// Add the mention comment to the notification
template.print('<p><b>Mention Comment:</b> ' + mentionComment + '</p>');

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

i didnt go the comment( you can see below)

why is that? maybe because work notes is private?
do you have a way to fix it?

ofekg_1-1734421593959.png

 

ofekg_0-1734421533269.png