0

I'm going crazy with this flow.

I have a Custom Object named Ri_Event__c with a lookup field to the Opportunity Object. Ri_Event__c also has a custom checkbox field named Completed__c.

I'm trying to create a flow that changes the Opportunity StageName to Closed Won when all the related Ri Events are marked as completed.

The flow is being executed after insert:

enter image description here

enter image description here

enter image description here

enter image description here

After getting the records and storing them in a Collection Variable called RiEventsCollection I'm looping them , checking if the Completed__c field equals true and then I would finally update the related Opp.

I have created an Opp with 3 related Ri Events to it. Two of them are already completed and the third one I'm updating it from the flow debugger to be checked.

enter image description here

This is the result of the debug:

enter image description here

I've tried MANY ways of doing this flow. First I tried retriving the related Opp of the Ri event triggering the flow, them from the related Opp the related Ri Events for THAT Opportunity but it wouldn't let me. So I tried getting the related Ri events from the related Opportunity from the Event triggering the flow, but it wasn't working as expected too.

1 Answer 1

1

You can use the opposite way by querying all the RI_Events whose completed__c is false. If that is null you can update status of opportunity to "Closed Won" as below .

we have "When no records are returned, set specified variables to null" check box turn that to true so that if no records are returned it returns null.

enter image description here

We can use that variable above to check null and then update the opportunity stage.

enter image description here

In this way we are checking if no RI_Events related to opportunity has checkbox as false then we can update the status of opportunity.

10
  • Hey SaiPraveen! Thanks for your reply. I cannot understand the logic here sience I want to update the Opportunity to closed won when all the ri events are Completed, not the opposite. Why would I do it the opposite way ? Cannot understand the logic here. My problem is that when I update the last Event to be completed from the debugger, the other two are still marked as completed but this third one is the one failling the flow and still not marked as completed. Cannot undestand why this is happening either. Feb 28, 2023 at 16:34
  • 1
    @NachoZveDeLaTorre, We are not doing opposite. Instead of getting all RI events and looping them and checking Completed__c field I have queried RI events whose Completed__c is false and stored them in a variable . If that variable is null which means there are no RI events with Completed__c as False which means all are True then we can update oppy stagename Mar 1, 2023 at 2:52
  • Sai! Thanks for the answer and help again. I do know one of the records is marked as completed = false since in this case there are only 3 events and two of them where completed by myself and the third one is causing the flow to fail. My question is ... I cannot undestand why this is happening. In the debuger I'm causing the flow to fire when a Ri Event is updated and the only change is Completed going from false to true since I'm checking the checkbox. That should make the flow update the Opp at the end, but it is ending in the END from the condition. Mar 1, 2023 at 7:17
  • I believe that if I do what you suggest I will still get the last record as completed = false, but I will try it and let you know. Thanks a lot! Mar 1, 2023 at 7:19
  • Indeed. I've tried this way as well but still failing. I cannot undestand what's wrong with it. Mar 1, 2023 at 8:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .