Calling all Salesforce Flow Experts!

Goal: Identify the single Max/Most Recent "Contacted Date" for all related child records on a related child object called "Opportunity_Contact__c". This field is populated manually by the user.

Setup: Opportunity_Contact__c is a child object and has a Master-Detail Relationship to Opportunity. I have created 2 custom fields on the Opportunity Contact object:

  1. Contacted_Date__c (Date)
  2. Most_Recent__c (Checkbox)

Process Builder: When an Opportunity_Contact__c record is created/edited, launch the below flow process and send a variable for the Opportunity.Id via a variable created on the flow called "varOppContact" (that is associated to the Opportunity_Contact__c child record)

Flow Design:

1) Use a Fast Lookup element to perform a lookup to the Opportunity_Contact__c object where the Opportunity Id matches the Opportunity Id and where "Opportunity_Contact__c.Contacted_Date__c" contains a value (is not null).

In the same Fast Lookup element, save the "Opportunity_Contact__c.Contacted_Date__c" and "Id" in an SObject Variable called "RecentDate".


2) Using a "Loop" element, loop through all related Opportunity_Contact__c records from previous step and store in a sobject variable called "MaxDate".


From here, I believe I need to do the following:

3) Use a "Decision" element to perform a comparison if the "MaxDate" variable is greater than the value stored in "RecentDate".


I'm not sure what step(s) are involved next.

I would venture I need an "Assignment" element to store the greater of "MaxDate" & "RecentDate"into the "RecentDate" variable.

Following this, how would I "uncheck" then "check" the "Most Recent" checkbox on the Opportunity_Contact__c record. I would venture for that I would also require a couple of Fast Update steps would be needed here.

Below is an overview I have built so far:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.