Skip to main content
kristin_f3c469
Contributor ⭐️⭐️⭐️⭐️⭐️
March 19, 2015

Rule Date Comparisons in Rules Engine

  • March 19, 2015
  • 7 replies
  • 387 views
When creating Rule Criteria using "Rule Date" as the value, is seems that "Rule Date" is evaluating as a full date/time value, rather than just the Date. This is confusing and is inconsistent with other Salesforce date comparisons. 

My use case is this -
Rule 1 adds Customers into the Customer Repository
Rule 2 takes and Customers with Create Date=Rule Date and add the New Customer Onboarding CTA. However the evaluation doesn't work because Rule Date is the full string of date and time.

I have a workaround for this, but would like to see date comparisons be done just on the actual date.

    7 replies

    dstokowski
    Gainsight Employee ⭐️⭐️
    March 25, 2015
    That makes sense Kristin and I have encountered that too.
    kristin_f3c469
    Contributor ⭐️⭐️⭐️⭐️⭐️
    May 11, 2015
    Gainsight Team -

    Any thoughts on this? It continues to be quite confusing when rules don't work because the Created Date operator is "Equals", and the field value is a date/time stamp. Then I have to remember to make it "Greater or Equal to". All other date fields in Salesforce work using an "equal to" operator when comparing date values. Being consistent within the FORCE platform is important for administration.

    thanks
    Kristin
    murthy_kavali
    Contributor ⭐️⭐️
    June 4, 2015
    Hi Kristin,

    Thanks for bringing this up, Let me explain you how RuleDate works, When we compare RuleDate against 'DateTime' field it will be compared as 'timestamp' where as if we do it against 'Date' field then it will compared as just Date.
    So in your context, In Rule1 while adding Customers into the Customer Repository, try to load RuleDate into any 'Date' field. (Note: CreatedDate is a DateTime field, so not useful in this case).
    If you don't have any 'Date' field then create one in customerInfo Object or somewhere else.
    In Rule2 you can use the above Date field against Rule Date.

    In Rules -> Setup Rule -> left hand side field listing, if you mouse over on a field then tool tip shows you which datatype it is.

    Hope this helps you, please reply for any clarifications.

    Thanks
    Murthy Kavali
    sundar
    Expert ⭐️
    June 4, 2015
    Kristin,

    You can use a Formula field(Date filed) to convert DateTime to date and achieve this

    your_new_date_field_formula = DATEVALUE(CreatedDate)

    Use this new date field in Rule filter.

    Let me know if this helps
    kristin_f3c469
    Contributor ⭐️⭐️⭐️⭐️⭐️
    June 12, 2015
    Thanks for the explanations. Just seems like extra work for the Admin, and creation of extra fields, when the system should just take care of doing the date comparison. I don't believe there is a field type distinction when working in the Sales Cloud application. Date comparisons are done on just the date regardless if the field being compared to is a date/time field.

    thanks
    Kristin
    jitin_mehndiratta
    Helper ⭐️⭐️⭐️
    September 13, 2017
    Hi Kristin,

    We are introducing formula functions within Rules Engine for fall release. One of the formula is to convert Datetime to Date field within Rules Engine itself. I believe this will simplify things further. I will keep you posted on this.

    Thank you,
    Jitin
    jitin_mehndiratta
    Helper ⭐️⭐️⭐️
    January 24, 2018
    Hi Kristin,

    You can use the Date() function in the transformation task of Bionic Rules which will convert Datetime to Date value.

    Regards,
    Jitin