Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Locking CRM 365 custom workflow

(0) ShareShare
ReportReport
Posted on by 10

I have custom workflow execute when record creates. The WF doing following operation:

1) Read the attribute i.e availability

2) Calculation -> new availability = availability - quantity

3) Update availability

Above functionalities perfectly working (get updated availability) when I create a new record through CRM front browser.

However, I have external REST API which creates multiple records at the same time. Then I am getting wrong availability due to concurrency issue. 

I have tried with lock (SyncLock) but sees it doesn't work. Is there any way to lock the code piece in CRM to handle the concurrency? 

 

*This post is locked for comments

  • Gayan Coomasaru Profile Picture
    10 on at
    RE: Locking CRM 365 custom workflow

    yes it is sync WF

  • Suggested answer
    Drew Poggemann Profile Picture
    4 on at
    RE: Locking CRM 365 custom workflow

    Hi Gayan,

    Have you looked at the optimistic concurrency capability that was released with Dynamics CRM 2015?  

    msdn.microsoft.com/.../dn932125.aspx

    I think this is meant to address the types of issues you are having with concurrency.

    Hope this helps!

    Thanks much,

  • Chadi Tannous Profile Picture
    1,039 on at
    RE: Locking CRM 365 custom workflow

    Is it a real-time workflow

  • Gayan Coomasaru Profile Picture
    10 on at
    RE: Locking CRM 365 custom workflow

    yes it is organisation level

  • Chadi Tannous Profile Picture
    1,039 on at
    RE: Locking CRM 365 custom workflow

    Did u make sure the workflow is organisation level and not user level

  • Suggested answer
    Gayan Coomasaru Profile Picture
    10 on at
    RE: Locking CRM 365 custom workflow

    Finally resoved the issue. I convert workflow logic to plugin, then its work

  • Gayan Coomasaru Profile Picture
    10 on at
    RE: Locking CRM 365 custom workflow

    I tried with updating the master entity. But no luck so far.

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: Locking CRM 365 custom workflow

    Okay. Then try updating the master entity before starting any calculation. The update could be anything. When you perform an update in a workflow/ plugin transaction, it will create a lock.

    Try this and let me know if this works.

  • Gayan Coomasaru Profile Picture
    10 on at
    RE: Locking CRM 365 custom workflow

    The availability field in separate (masater) entity.

    We have two entities A and B relationshipe ->  1 to M

    Service creates multiple B's then WF will trigger and availablity will updated to A

  • RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: Locking CRM 365 custom workflow

    Hi Gayan,

    Is this availability field is in the same entity which is being created or separate? If it is in the same record which is being created then I don't think there should be any issue with multiple requests as they all will be for a specific record.

    If not, could you please share some more details about you code/ implementation?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans