Race Condition Issue

Comments

6 comments

  • Scott Henderson CTO
    Celigo University Level 1: Skilled
    Answer Pro
    Top Contributor

    Are you positive that both the flows are using the exact same connection record, and can you confirm that you set the concurrency level on the connection to 1?  This should solve the issue, because concurrency level 1 means that only a single update will happen at a time.

    0
  • Nuri Ensing NetSuite Integration Whiz
    Celigo University Level 4: Legendary
    Awesome Follow-up
    Engaged

    Thank you for your response Scott! I can confirm that both real-time flows are using the same connection record, "Dynamics 365 BC - with concurrency set to one", and the concurrency level is indeed set to 1. Despite this configuration, I am still encountering the race condition issue.

    I understand that setting the concurrency level to 1 should ideally resolve the problem by allowing only a single update to happen at a time. However, it seems that this solution is not working as expected in my case.



    0
  • Scott Henderson CTO
    Celigo University Level 1: Skilled
    Answer Pro
    Top Contributor

    Strange. From the Celigo side, if concurrency level is set to 1, then we will only send 1 single request at a time.

    I am not familiar with business central, but i wonder if there are any triggers or script type things happening on the business central side that could be causing this. Another idea I will try to flush out internally is if we can prevent the Account triggering in Salesforce when only the address is changed. This is all dependent on what Salesforce allows though. I will report back if I learn anything helpful.

    0
  • Nuri Ensing NetSuite Integration Whiz
    Celigo University Level 4: Legendary
    Awesome Follow-up
    Engaged

    We've put some logic in Salesforce to stop the account from being triggered when only the address is modified. This seems to have taken care of the issue with the account and address running at the same time. 

    As for the Business Central aspect, I'm going to look into it further to see if it's contributing to the problem in any way. 

    0
  • Muneswara Thotakura NetSuite Integration Whiz Salesforce Integration Whiz Software Engineer
    Answer Pro
    Celigo University Level 4: Legendary

    Hi Nuri Ensing
         Here are a couple of solutions for your issue.
    1. Reg: concurrency 
        As both flows are running parallel, and if we set concurrency 1, we request to Microsoft only one request at a time.
    why do you get an error? It's because, as you are trying to fetch Etag from BC to set it in headers., we request to BC one by one and Etag is getting modified after the first request for a customer record we are trying to set the same tag for addresses for a customer record, and it's already changed, that's the reason it will throw an error from BusinessCentral as "record has already been saved".
    Resolution: One way we need to set headers as * instead of exact Etag, as we use concurrency 1., it's fine to use it.
    2. Yes As you did it., we need to stop updating parent records i.e., Account when we are updating the Address record (related list), through the custom trigger/filters for account export we can achieve it to pick only specific record.

    3. Instead of two flows you can have a single flow., As the address record is updated parent record is modified.
    you can create a Salesforce listener for Account Export and you can include the related list as "address" and you can fetch both at a time from the same export.

    1
  • Nuri Ensing NetSuite Integration Whiz
    Celigo University Level 4: Legendary
    Awesome Follow-up
    Engaged

    I see I did not respond to your answer Muneswara Thotakura. Although some time has passed, I wanted to let you know that the ETag solution worked perfectly.

    0

Please sign in to leave a comment.