web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Delete a record leads to error 547

(0) ShareShare
ReportReport
Posted on by 19

Hello,

I have a problem deleting an sales order record. I get the following error message:

System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: Sql error: Generic SQL error. CRM ErrorCode: -2147204784 Sql ErrorCode: -2146232060 Sql Number: 547

The 547 means that there are dependent data and cannot be deleted.
I have also partially analyzed the problem.

A short description of what I do:
I have an asynchronous workflow that updates a record and performs a few calculations on the record and also creates dependent data.
If the workflow has not run yet and I delete the record, it can happen that the deletion and the calculation run at the same time.

I have logged which stages are called in which order:

DELETE => 10
UPDATE => 10
UPDATE => 20
UPDATE => 40

As you can see, first the PreValidation-Delete is called, then the Update-Stages, after that the error message appears.
This means that before the PreOperation-Delete is called, the update creates new data records.

Does anyone have any ideo how to lock the record, so that the update is not executed?

Thank you

*This post is locked for comments

I have the same question (0)
  • Verified answer
    erhan.keskin Profile Picture
    2,253 on at

    Hi,

    What I understand from your case is that;

    - You can check if there is any active WF instance against the record in PreValidation of Delete and prevent from deleting.

    - Or you can cancel WF instances in PreValidation of Delete

    Regards,

  • Fosco Profile Picture
    19 on at

    Hi,

    the second point was my thought as well. But I have run in the same problem.

    But I think  I solved it now. As you suggested, I cancel the workflows, if there had been workflows I wait 5 seconds. And check again if there are still a workflow. When there is still exists a workflow, i prevent the deleting.

    But only again for me to understand the order of stages when a record and the child records are deleted.

    1. PreValidation (Master)

    2. PreValidation (Child)

    3. PreOperation (Child)

    4. PostOperation (Child)

    5. PreOperation (Master)

    6. PostOperation (Master)

    So if new records are inserted between point 1 and 5, my problem occurs.

    I'm guessing that the internal system checks directly before the PreOperation (Master) if there a dependent data. And there is my problem.

    Regards

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
AS-17030037-0 Profile Picture

AS-17030037-0 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans