0

We have a flow which gets triggered when an Order record is activated. Flow does some query etc and creates a record of a related Object BillingSchedule (BillingSchedule has a lookup to Order).

As part of testing, our team cam eup with an impractical scenario, but we have to fix it nevertheless.

If we create 2 copies of the flow (so exact same flow, just 2 different API names), they both gets triggered at the same time and create 2 records of BillingSchedule at the same time. We do not want that.

Putting any checks within the flow like - "If a BillingSchedule exists for this order, dont create one" doesn't stop the issue, because both flows run perfectly in sync, and when they reach this validation, either of the flow has created the record in database yet. These checks are there and prevent duplicate records of BillingSchedule from being created, when flow is run multiple times sequentially. But running two instances of same flow bypasses these validations.

Also, we do not have ability to put a constraint of "unique" on the lookup field (due to other business requirements).

Is there anything in salesforce platform that can help resolve this?

If i change the flow from being record driven to platform event driven, we run into same issue. Lets say when order is activated, a platform event is published. Now if we create multiple copies of our flow, they ALL will subscribe to this event, and they ALL will run at the same time.

1
  • 1
    did you look at this help article? If both flows are triggered on the same Order, they'll execute in a defined sequence meaning the second to execute could check whether the first to execute had happened
    – cropredy
    Jan 23, 2023 at 23:40

1 Answer 1

2

The scenario you've highlighted isn't a technology issue, it's a development process one. From a platform perspective, what you're experiencing is working as expected as you've created two distinct flows from a Salesforce perspective.

In that sense, there isn't anything to 'fix' from a platform perspective, but you need to look at the process that you use to gather requirements, come up with solutions and then QA check what's been developed. It sounds like you need to explore the exact scenario that's been raised further but I'd be clear with them that there isn't a tech fix for this.

You must log in to answer this question.

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