Process builder - update date on related record - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Simon DukeSimon Duke 

Process builder - update date on related record

I have a Visit object that captures records of visits made to our Accounts. Visit records are created through an integration. When a Visit record is created or edited, a process is launched that invokes a flow if the Account lookup field on the Visit record is Null. The flow then attempts to find an account with an exact match name to the Site Name (text field) on the Visit record. If found, the Flow sets the Account Name (lookup) on the Visit record. Up to this point, I have this working successfully.

I now need to evaluate a Date/Time field on the related Account (Last_Visited__c), and IF this Last_Visited__c is less than the Departure__c on the Visit record (also Date/Time), then to update the Account Last Visited Field with the value from the Visit Departure field. My setup looks correct to me, however, it's not working. I'd really appreciate it if someone could look through the below and let me know where I've gone wrong? Let me know if you need screenshots from other parts of the flow/process.

Screenshot - PB
Best Answer chosen by Simon Duke
Simon DukeSimon Duke
I've found the issue. I needed to enable Recursion

Enable Recursion Screenshot

All Answers

Manasa UdupiManasa Udupi
Hi Simon,

Can you click on the First "Stop" and select 'Evaluate the next criteria' and Save.
 
Simon DukeSimon Duke
Hi Manasa

I've made that change, and retested. The flow is firing fine, and the Visit is being related to the Account via the lookup field, which is expected. The next steps in the process are not working however? The Departure Date/Time from the visit record is not being updated to the Last Visited Date/Time field on the Account record, even though the Last Visited field on the Account Record is empty. 

Simon
Manasa UdupiManasa Udupi
I guess the issue is with the criteria. Since the Flow updates the Account lookup, the criteria Account = Null is no longer satisfied, hence the Update action is not performed.

Can you provide more information on the second Criteria and the Immediate Action? 
Simon DukeSimon Duke
I currently have the same immediate action on the second criteria, with the second criteria being:
Account (Vlookup on Visit record) has changed and Account is Not Null. The action should then be to evaluate whether the Last Visit (Date/Time) on the Account Record is less than the Departure (Date/Time) on the visit record and if so, to update the Account Record Last visit with the Departure value from the Visit record. 

Criteria
2nd Criteria Step Above

Immediate Action
Immediate Action above
Manasa UdupiManasa Udupi
I tried this setup in my Dev org and it seems to be working in both the cases -  If I put the Update Action in the same node as flow, as well as separate criteria.

Can you double check if the criteria that you have specified to execute the field update is right?
Also make sure you are using the right record that meets the criteria specified for testing.
 
Simon DukeSimon Duke
I've found the issue. I needed to enable Recursion

Enable Recursion Screenshot
This was selected as the best answer
Shruti kShruti k
Hey Simon,
Can you click on the First "Stop" and select 'Evaluate the next criteria' and Save.
And in process builder check recursion checkbox to true.