JO/Rules Engine: Is there a way to compare date fields from one object to another?

  • 31 December 2015
  • 9 replies
  • 71 views

Userlevel 7
Badge +3
I have a use case where I need to compare a date field from one object (Contacts) to another object (CSTask).  Essentially I want a Co-Pilot email to be triggered to any Contacts whose Created Date >= 2 days from CSTask Closed Date.  Doesn't appear I have that option, but would love to be corrected.  



If this capability does not exist, can this question be converted to an idea? Because this would be a very valuable addition.

9 replies

In the rules engine... could you use a calculated field in Actual Value mode and Show Field option to make a "Days since CSTask Closed Date" field, then build actions and criteria off that?
Userlevel 7
Badge +3
Thanks for the suggestion Matt!  When you say to "make a field" are you talking about storing a field permanently in MDA or just during rule run?



That pesky calculated field - I haven't used it much nor had much training on it. I'm gonna have to do some research on how it works or set up some time with my CSM. 
Depends if you intend to just use it for this or other things in the future. If this is a recurring item then it makes sense to put it in SFDC or the customer info object to reuse. For things like rate of change calculations, the value itself isn't of lasting value so I like calculated fields to keep the bloat down.



The one weird thing, is that you might need to play with Max date to get the most recent activity date, given you are interacting on a single account object with multiple CSTask object relationships.
Userlevel 5
Jeff, Can you help me understand the usecase here. Do you have contact associated with CTA (Associated contacts) and trying to reach them out using copilot?
Userlevel 7
Badge +3
Essentially yes.  But there is probably a broader topic here with the ability to compare and contrast date fields (within an object as well as across multiple objects).  
Userlevel 5
In Rules Engine, you can compare two dates. Pick them in show fields and move on to setup action. In action criteria you can compare one date field with other. 





But CTA Associated contacts cannot be used in copilot since it does not have account lookup directly on that object. 

Rules Engine Calculated fields work only on numeric fields and not on dates.
Userlevel 7
Badge +3
Actually I think I didn't understand your original question.



The contact is not associated with the task.  I just want to be able to look for any contact that was newly created on an account >= 2 days since the Closed Date of a specific CSTask record and send an email outreach.
Userlevel 7
Badge +3
Sundar - revisiting this item because it really is a limitation of the tool to not be able to compare two fields like this.



I should be able to, for example, have criteria in a rule that returns TRUE if  



Contact::Created Date >= CSTask::Closed Date 

OR

Contact::Created Date <= Call To Action::Created Date
Userlevel 5
This requires enhancement at Rules Engine Action level to allow advance logic. 

Reply