how to trigger event/notification based on the work notes of the sctask

Vinod S Patil
Tera Contributor

Hello Everyone

I have requirement to trigger the notification when work notes updated in sctask  and it should have the below value then only it should trigger.

error message 'file share failed' and it should have incident number.

Please suggest me on this.


@Ankur Bawiskar 
@SANDEEP DUTTA 

1 ACCEPTED SOLUTION

@Vinod S Patil 

I already shared how to check 1 value, enhance the logic to check for other

you can use this to print the work notes in email body, why email script is required?

Advanced notification condition

var worknotes = current.work_notes.getJournalEntry(1);

if(worknotes.indexOf('file share failed') > -1 && worknotes.indexOf('Incident number') > -1){
	answer = true;
}
answer = false;

Email body:

${work_notes}

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

View solution in original post

6 REPLIES 6

@Ankur Bawiskar  below script not working please guide me on this. This script I am using in the advance script in the notification.
Condition: work notes -> Changes

var worknotes = current.work_notes.getJournalEntry(1);
if (worknotes && worknotes.toLowerCase().indexOf('file share failed') > -1) {
   
    var incidentRegex = /\bINC\d{7}\b/i;

    if (incidentRegex.test(worknotes)) {
        answer = true;
    } else {
        answer = false;
    }

For the reference attached screenshot, when incident and 'fail share failed' it has to trigger the notification.


VinodSPatil_0-1751893819213.png

 




} else {
    answer = false;
}

@Vinod S Patil 

what are you trying to search?

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