Case expression/date option

Related products: None

It would be fantastic if we had the option to use dates (and dates from fields) in the case expressions of the Rules Engine.

 

The use case for this would be analysis on data requiring a date to ultimately be the item produced (i.e., opportunity analysis, determine specific date, load to company).

I also ran into a need for date values as a result of a case expression when trying to define a ‘last activity date’ on Goals or Success Plans. Since the modified date on the Goal/SP does not update when an associated CTA/Objective is updated, and the CTA’s modified date isn’t updated when a timeline entry is logged against it, I needed to build a rule to pull the max modified date at each level and merge it all back to the Goal/SP in order to get a count of records with interactions against it in the last 90 days. I ended up using a transform task to filter the records included where none of the associated dates were within 90 days, but a case expression would have allowed me to condense all the date fields into a single ‘last activity date’ value and filter on that.


You can achieve this a few different ways today as a workaround.

 

A)

-Add a transformation task where you subtract your date fields from today. giving you numbers. I.E. 8/29/23 and 8/30/23 ( 1 and 2)

-second transformation filter your date filters. If 8/30/23 >= to 8/29/23 then output your 2 else output your 1

-third transformation, take your case date field and add date function to today. So if two was from previous task then 2 plus 8/28/23 is outputting 8/30/23.

 

B)

-Take your date fields in a transformation task and To String, a function in HRE or DD not sur ein bionic, them.

-In a second transformation filter on your date fields and output your string date fields, much like option A.

-Third transformation you To Date, function in HRE and DD not sure in bionic, your date string fields.


@Wayne For the third transformation in option A, should there be an option to pass the CaseDate value into the add date function? It seems to only accept a typed value rather than a field value.

In this example I’m trying to define the MaxDate value to show the most recently active date per record (completion occurs after enrollment, so if completion is not null, MaxDate should be the completion date, else enrollment date). With the option A workaround I get as far as set 3 before I run into this issue. Here’s the data I’m working with for context;

 


My biggest issue with additional steps is they take longer to run and produce tech debt!


Option B works perfectly, for anyone else that stumbles across this post. Thanks again @Wayne for the workarounds!


My biggest issue with additional steps is they take longer to run and produce tech debt!

 

Agreed, but you will always have tech debt. You have to find the happy medium you and your company is willing to accept. Also, some things the business side does not want to hear “no”, so you have to do it.

 

@Wayne For the third transformation in option A, should there be an option to pass the CaseDate value into the add date function? It seems to only accept a typed value rather than a field value.

 

 

You are correct sorry about that. Option A you have to do with Bionic rule, seems like you can only add via a field not value with it. I’m going to go post in Horizon Rules Engine that this si a parity issue.

 

Option B works perfectly, for anyone else that stumbles across this post. Thanks again @Wayne for the workarounds!

 

Happy it worked out!


Appreciate there is a workaround for this, having date as a datatype in this feature would be a huge win for date evaluation/comparison, making the output the date you’re looking for.


Resurfacing this again as I continue to run into this.. The workaround for not being able to evaluate dates in a case expression is painful to build. This is probably one of the times I’d take the feature being added (even with limitations) rather than not have it!