Possible Race Condition Causing False Errors in Salesforce Quote Line Items Flow

Hi all,

I am encountering false errors that seem to be caused by a race condition in my flow. I have a flow that adds quote line items to a quote in Salesforce. Before adding the new quote line items, the flow checks if the quote already has line items. If there are existing line items, the next step deletes them, and the final step adds the new line items.

The process works as expected: the line items are successfully deleted and added in Salesforce. However, the delete flow still generates errors:



Errors:

In the last two flow steps, I also included a concurrency lock template to prevent potential race conditions:


The json of a quote line items looks as follows:

{
"attributes": {
"type": "QuoteLineItem",
"url": "/services/data/v54.0/sobjects/QuoteLineItem/0QLUW000001aFcg4AE"
},
"Id": "0QLUW000001aFcg4AE",
"Quantity": 22,
"UnitPrice": 36.8,
"Quote": {
"attributes": {
"type": "Quote",
"url": "/services/data/v54.0/sobjects/Quote/0Q0UW0000000CPN0A2"
},
"Invoice_BC_Id__c": "2CFA6836-078F-EE11-8178-000D3A1455C0"
}

Any help would be appreciated!

@nuriensing what's your source export? Are you using a one-to-many on your delete lines and create lines step?

Hi @tylerlamparter

The source export starts with an HTTP request from Business Central. When retrieving the quote lines, it fetches them from Salesforce. In the next step, it deletes the lines from Salesforce based on the data fetched in the previous step using a one-to-many relationship. Finally, it re-adds all the lines again with a one-to-many relationship, but this time based on the line items from Business Central.

I also discussed this problem with @basvanditzhuijzen After thoroughly checking the system, we did not make any changes because we couldn’t identify any specific issue anymore. The problem seems to have resolved itself and is not occurring anymore. It might have been a temporary Salesforce glitch. If the issue happens again, I will update this forum thread.