Trigger an email based on two conditions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2022 05:20 PM
I have the following code which obviously does not work. The idea is to send an email using Event is fired.
I want to include in the email the part numbers where the Ready for UDI Data Entry is "Yes" and the Complete Status is "In Progress".
Each record is associated to an SCTASK, so I need to send one email where the Task No's are the same so I can include the part numbers for that Task No.
In this example when I change the Ready for UDI Data Entry to Yes, it should trigger an email notification for SCTASK0080343 that includes its respective Part Numbers, same case for SCTASK0080220 but that should be a separate email.
This is the scheduled script I have. Any help on this please?
var udi_gr = new GlideRecord('u_udi_tracking_data');
var gr = new GlideRecord('sc_task');
//gr.addQuery('state', 'Open'); //Check if the state is open
udi_gr.addEncodedQuery('u_status=Yes^u_complete_status!=Complete');
udi_gr.addQuery('udi_gr.u_task', 'gr.getUniqueValue()');
udi_gr.query();
while(udi_gr.next()) {
gs.eventQueue('UDI.EmailSME', udi_gr); //It will fire the event
}
- Labels:
-
Notifications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 08:20 AM
You're welcome 🙂