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.

Notification Condition Script

Wyatt Fudal1
Tera Guru

Hello ServiceNow Community, 
I ran into an issue with having a notification send out based on certain conditions. We have a custom dropdown field in our group records named EA/IT services. This helps us divide our groups into two camps.  Either IT services or EA. This carries over to the Incident table. When a technician leaves a comment in the Additional comments depending on which assignment group the technician resides a different notification will be sent. I have it working to an extent but would like to add a condition in the notification and need assistance in writing the script for this. Thank you all.

IT Service notification

WyattFudal1_0-1709916504545.png
EA Notification 

WyattFudal1_1-1709916584941.jpeg

Group Record 

WyattFudal1_2-1709916636581.pngWyattFudal1_3-1709916653814.png

 

WyattFudal1_4-1709916661567.png

 

 

7 REPLIES 7

Currently, we have a read-only field named EA/IT Services in the incident record. The field auto-populates based on the assignment group EA/IT field designation. Which will trigger one of the notifications explained above. Which works 90% of the time. Sometimes the EA/IT services field is left null in the incident record. So if the technician leaves a update via the comments the caller will not get the notification because the condition for the EA/IT service field is null. I was able to correct this by a flow design but I want to see if I can have the notification skip the incident record EA/IT services field condition and send notification based on the assignment group EA/IT services designation.  

@Wyatt Fudal1 I am assuming here in all scenario you will have "EA/IT services" value on Group record ? is that my correct assumption ?

 

You can apply dot walk filter in your notification. 

doc link : Dot-walking examples 

 

If you want to use script in your advanced notification condition then try with below samples. 

 

  if(current.assignment_group.u_ea_it_services.getDisplayValue() == "EA"){ // You can add many more condition based on your need. 
    answer = true;
  } else {
    answer = false;
  };

 

Thanks,

Harsh

 

I apologize for the delay. The EA/IT services value is also on the group record. I'm very much a novice. Should I add a query to get the EA/IT service field value from the group record?