web
You’re offline. This is a read only version of the page.
close
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

I have the same question (0)
  • RaviKashyap Profile Picture
    55,410 Moderator on at

    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?

  • Gayan Coomasaru Profile Picture
    10 on at

    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

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    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

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

  • Suggested answer
    Gayan Coomasaru Profile Picture
    10 on at

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

  • Chadi Tannous Profile Picture
    1,039 on at

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

  • Gayan Coomasaru Profile Picture
    10 on at

    yes it is organisation level

  • Chadi Tannous Profile Picture
    1,039 on at

    Is it a real-time workflow

  • Suggested answer
    Drew Poggemann Profile Picture
    4 on at

    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,

  • Gayan Coomasaru Profile Picture
    10 on at

    yes it is sync WF

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans