Here’s a quick overview (from Gemini). Hope this is helpful! 😀
How to Use Dates in Query Logic
You generally have two ways to work with dates when setting up filter criteria:
-
Specific Dates: You can pick an exact calendar date. This is useful for one-time queries or when you have a fixed, important date, but it's less common for automation.
-
Relative Dates: This is the most powerful and common method. Instead of a fixed date, you use a dynamic value relative to the day the query runs. This is what makes automation possible. Gainsight provides a rich set of options for this.
Key Concepts: "Rule Date" vs. "Today"
When working in the Rules Engine, you will see two important relative date options:
-
Today: This always represents the actual, current calendar date.
-
Rule Date: This represents the date for which the rule is scheduled to run. Most of the time, this will be the same as "Today." However, if you ever run a rule for a historical period (e.g., re-running last week's rule), Rule Date will be that past date, while Today would still be the current date.
Best Practice: For consistency and accurate historical runs, it's almost always better to use Rule Date in your rule criteria instead of "Today."
Example Scenario: Finding "At-Risk" Renewals
Let's say you want to create a Call to Action (CTA) for every customer whose renewal is coming up in the next 90 days.
Your query logic in a rule would look something like this:
-
Fetch Data from: Customer object.
-
Apply Filter Criteria:
-
Renewal Date | greater than or equal to | Rule Date
-
AND
-
Renewal Date | less than or equal to | addDays(Rule Date, 90)
This query effectively creates a 90-day rolling window, and any customer whose renewal date falls within that window will be pulled into your rule's action.
Some resources:
-
Formula Fields in Rules Engine
-
Advanced Operations in Gainsight Data Management
-
What it covers: This article provides a comprehensive table of date functions like Date Add, Date Sub, First Day of Week, etc., that are available in various parts of Gainsight, including the rules engine.
-
Schedule and Execute Rules
-
What it covers: While this article is about scheduling, it's useful because it explains how to run rules for historical periods, which is where the distinction between Rule Date and Today becomes very important.
These documents are the official source and should give you everything you need for working with date values in Gainsight's query logic.