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.

condition for the notification

Shir Sharvit
Tera Contributor

Hey.

 

I need to build a condition for the notification so that an email will be sent only when the additional comments are changed by the assigned to.

 

I have tried this code but it  didnt work:

ShirSharvit_0-1702206352013.png

 

can someone fix it for me please 

 

7 REPLIES 7

abirakundu23
Giga Sage

Hi @Shir Sharvit ,

It should be work if you add condition in "Additional Commets" changes. 
Please try once.

AbiraKundu_0-1702210214783.png

@Shir Sharvit , please try once. Also check @Danish Bhairag2 post

 

can you please send a picture how it should look 

this is not working

Danish Bhairag2
Tera Sage

Hi @Shir Sharvit ,

 

In your script in order to check if assigned to name is there or not use something like this

 

var assignedTo = current.assigned_to.getDisplayValue();

 

if(current.comments.changes() && current.comments.getJournalEntry(1).includes(assignedTo) > -1){

answer = true;

}

 

Thanks,

Danish