Date filters usage in Rules Engine

  • 23 September 2020
  • 2 replies
  • 1161 views

Badge
  • Gainsight Employee: Rookie
  • 5 replies

Hi, Gainsight Admin community!

During rules configuration, the common question most of the customers ask is about choosing right date filter they can include in order to restrict the data to a certain time period.

Here are a few common use cases:

  1. Renewal date in the coming two months 

  2. Subscription start date in the last 3 months

  3. The activity date is within the last 7 days of the subscription date.

  4. From opportunity close date is 180 days for today then Create CTA

Now the question is what we have to select from the criteria drop-down i.e subtract N days/ Add N days etc.


Background to understand what exactly happens in the backend:
 

Usecase

What to use

Description

Example (mm-dd-yyyy)

Renewal date in coming two months

Solution1: 

Renewal date <= (Add N days to rule date + 60 ) AND 

Renewal > Ruledate

 

Solution 2: Renewal date <= (Add N months to rule date + 2 ) AND 

Renewal > Ruledate


 

Rule date = Today’s date

Add N days to Ruledate +60 translates to Add 60 days to Today 

If today = 1/1/2020

Then 60 days + 1/1/2020 equals 3/2/2020 

 

Renewal date <= 3/2/2020 

 

AND 

 

Renewal date > 1/1/2020

Subscription start date in the last 3 months

Solution1: 

Subscription start date >= (Subtract N days from rule date - 90 ) 

 

Solution 2:

Subscription start date >= (Subtract N months from rule date - 3 ) 


 

Rule date = Today’s date

 

Subtract N days to Ruledate - 90 translates to a date which is exactly 3 months from today

If today = 1/1/2020

Then 1/1/2020 - 90 days equals 10/03/2019

 

Subscription start date >= 10/03/2019 fetches the last 3 months dates

From opportunity close date is 180 days for today then Create CTA

Solution:

 

Opportunity date = Subtract N days from rule date - 180 

 

(Schedule this to run daily)

Rule date = Today’s date

 

Subtract N days to Ruledate - 90 translates to a date which is exactly 180 months from today then the equality validates.

If today = 1/1/2020

Then 1/1/2020 - 180 days equals 07/05/2019 

 

Opportunity close date = 07/05/2020 then CTA will be created

The activity date is within the last 7 days of the subscription date.

Using the date function calculate the date difference between the activity date and Subscription start date (Refer here)

Date Diff(start date,end date,days)

---

Date Diff(Subscription start date, Activity date, days)

Criteria: Date diff <= 7

If Activity date = 01/07/2020

Subscription start date = 1/1/2020

Then date difference is 01/07/2020 - 01/01/2020 is 6 days

 

6 <= 7days limit is true


 

The above use cases cover the standard steps that we follow to implement the most common criteria. All you need to do is pull the date field into the filter section of the task and include any of the required criteria then proceed with your next steps.

Please let me know in the comments section if you have any questions.

 

~Happy Gainsighting


2 replies

Userlevel 5
Badge +3

Super helpful @shivani. Thanks for sharing the detailed information with different use-cases.

Badge +2

Thanks for sharing this @shivani 

Reply