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

**URL:** <https://connective.celigo.com/t/possible-race-condition-causing-false-errors-in-salesforce-quote-line-items-flow/98>\
**Category:** Integrator.io\
**Tags:** error-handling, json, flow-builder, salesforce\
**Created:** [June 19, 2024, 9:25am UTC](https://connective.celigo.com/t/possible-race-condition-causing-false-errors-in-salesforce-quote-line-items-flow/98 "2024-06-19T09:25:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nuriensing](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/nuriensing/32/6918_2.png) [@nuriensing](https://connective.celigo.com/u/nuriensing)\
**Post date:** [June 19, 2024, 9:25am UTC](https://connective.celigo.com/t/possible-race-condition-causing-false-errors-in-salesforce-quote-line-items-flow/98/1 "2024-06-19T09:25:01Z")

</div>

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:

 ![5301043caa20740200000001-625bd18a84c5406eaa333c24e14b2bd7.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/2/2070ce5132d4db176ea34648a7fd3e40610efbaa.png)

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

 ![5301043caa20740200000001-60dcc862a63a4842b2e209eb39faa2cf.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/c/c712802a49457dd02125037cf53ddaace4ca3023.png)

 ![5301043caa20740200000001-a98ab0e04253458ba3b2291fe4a2dd00.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/7/737c2f5548201a8a1e2ac7cd004e7afa40aa20e0.png)

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!

---

<div class="post-metadata">

**Author:** ![tylerlamparter](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/tylerlamparter/32/9204_2.png) [@tylerlamparter](https://connective.celigo.com/u/tylerlamparter)\
**Post date:** [June 20, 2024, 3:25pm UTC](https://connective.celigo.com/t/possible-race-condition-causing-false-errors-in-salesforce-quote-line-items-flow/98/2 "2024-06-20T15:25:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nuriensing](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/nuriensing/32/6918_2.png) [@nuriensing](https://connective.celigo.com/u/nuriensing)\
**Post date:** [June 21, 2024, 9:26am UTC](https://connective.celigo.com/t/possible-race-condition-causing-false-errors-in-salesforce-quote-line-items-flow/98/3 "2024-06-21T09:26:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nuriensing](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/nuriensing/32/6918_2.png) [@nuriensing](https://connective.celigo.com/u/nuriensing)\
**Post date:** [June 23, 2024, 10:22am UTC](https://connective.celigo.com/t/possible-race-condition-causing-false-errors-in-salesforce-quote-line-items-flow/98/4 "2024-06-23T10:22:27Z")

</div>

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.
