Using Event Filters

Event filters are highly situational. Most of the time, users do not need to use them. However, sometimes there are fringe cases where an automated email needs to be set up for a particular scenario and the email should not go out to everyone that could possibly trigger the event.  In cases such as that, event filters are the tool to use.
 
For a minute, imagine that you have just run into a situation where old emails were never sent out due to an invalid document template, but someone was looking at document templates in your system and fixed the one that had problems.  Suddenly, people who have had emails queued in the system for a significant amount of time are receiving emails telling them that they are registered for classes that occurred months or years ago.
 
Well, at this point, you realize that it is too late to prevent the emails from going out, but you can prevent future invalid emails from going out.  To do that, you add the following filter to your registration events.
 
SELECT r.RegistrationID FROM tblRegistrations AS r INNER JOIN tblClasses AS c ON r.ClassID = c.ClassID WHERE (((SELECT COUNT(cd.ClassDateID) FROM tblClassDates AS cd WHERE cd.ClassID = c.ClassID AND DATEDIFF(d, GETDATE(), cd.ClassDate) >= 0) > 0 AND c.IsScheduled = 1) OR (c.IsScheduled = 0 AND DATEDIFF(d, GETDATE(), r.RegistrationDate) = 0)) AND r.RegistrationID = {ID}
 
As a result, you no longer have to worry about past emails for instructor-led training or for self-paced training because the class dates are validated to be in the future or for the current date for instructor-led and self-paced compares the current date to the registration date.
 
If your company is unable to write SQL code for custom filters, you can contact support@oaktree-systems.com if you describe the situation you are trying to account for and provide any additional information they request of you.
 
There is a 500 character limit on the Filter field at this time so efficient coding practices will need to be used.

Add Feedback