Hello Salesforce StackExchange Community,
Background:
Our company just implemented a new Flow that was created from a 3rd party company which we no longer have access to. Our company makes an app and customers are allowed to try it free. After their trial period is over and they need to start paying, they hit what we call the paywall. Once this event happens, a record on custom object called Paywall Hit is created. From there, our new Flow is triggered to run through certain Account and Lead criteria and create an Opportunity or not.
Issue:
We are finding that duplicate Opportunities are being created. In some cases, a new event from our company's app creates a Paywall Hit record and triggers the Flow. However, some events are being processed while the previous event is being processed and the previous event doesn’t complete all the way through to prevent the next event from doing the same thing. My understanding is that this is called a 'race condition'.
Question:
Is there a solution within Flow Builder grab the Opportunity record created before the existing one that is getting processed? Something like, if this Opportunity record is = previous Opportunity record, then ignore and don't create?
Below is a pic of the Decision element in the Flow where we believe this is happening. I hope this makes sense. Not sure if this is possible or not so I figured this would be the place to ask. Thank you all so much for you time and consideration with this question.