Question

Rule Date Proposed Change for Filters

  • 15 November 2016
  • 3 replies
  • 44 views

Userlevel 7
Badge
What breaks now? 

Rule is scheduled to run at 09:00 AM. There is a filter condition for Created DateTime > (Subtract 1 day from Rule date) AND Created Date <= Rule date. This filters the data that is created b/w 09:01 AM previous day and 9:00 AM of Today (Rule date).  What you may/may not realize is that a subtle issue with Rule date is that it is actually working as dateTime instead of just date and is using the Rule scheduled time for the time component instead of Start / End of day.

Proposed fix is explained below above, let us know if this approach breaks anywhere!  Our goal would be to release this solution soon.

Proposed Fix :  Honor simple english
Created date < Rule date 12:00AM
Created date >= Rule date 12:00 AM
Created date > Rule date 11:59 PM
Created date <= Rule date 11:59 PM

Also this would operate in the timezone that is set in Rules Engine.  For more background, please see https://community.gainsight.com/gainsight/topics/datetime-with-rule-date-filters-does-not-work

3 replies

Userlevel 7
Badge +1
This was a mind-boggling thing that I figured out, especially since this also causes confusion when you're working on and testing a Rule, since I [i]believe that the Rule Date in that scenario operates as midnight-to-midnight. So I fully support the change :-)

Potential hiccups to making this changeover:
  • On the date that you make the change, a Rule that ran yesterday [i]and the Rule that runs today would [i]both have picked up data from 12AM-9AM
  • How would the behavior work for "Add N Days to Rule Date", for example? I'm not sure whether that currently would use the datetime of the Rule run or midnight on the date of the Rule run.
  • There are times that I may want to run a Rule on all data that currently exists. Maybe you could add an option for "Rule Time"? That said, I can't think of a scenario in our particular setup where that would be important, so I can't say that it's high-priority!
Userlevel 6
Thanks Seth.
  1. You are spot-on. This will have an impact on the day this fix is shipped. Assuming that the actions are mostly Upsert they would be resilient to duplicate records (Unless the CTA's are closed within that few hours).
  2. Add N Days to Rule Date uses DateTime and has the same aforementioned problem. This will get addressed with the proposed fix.
  3. To fetch all the data that exists we can use createdDate <=(less than or Equal to) Today (Rule Date) which will bring in the data unto end of Today. To enhance Rules to work at hour level we need to enhance scheduler + Filters + Rule Date Time and the whole ecosystem in backend. This is part of the long term plan :)
Userlevel 7
Badge +1
Another thing just occurred to me, and I can appreciate it's a totally different part of the product, but it's similar...

How do Connector schedules behave in this respect? So they use midnight-to-midnight or is it based on the run time?

Reply