Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Delete sales order usi...
Finance forum

Delete sales order using Odata / API

(0) ShareShare
ReportReport
Posted on by 50

Hi
I am trying to delete a sales order using API DELETE method but I got the following error

{{baseURL}}/data/SalesOrderHeaders?$filter=SalesOrderNumber eq 'xx-xxx'

....

"message": "More than one resource was found when selecting for update.",
"type

  • Suggested answer
    Pete Alberts Profile Picture
    3,542 on at
    RE: Delete sales order using Odata / API

    I had the same experience a while ago.

    You are correct with your own answer. Even if your filtering assures that only a single record is retrieved (for example the filter you mentioned in your post), updating and deleting will not be allowed. The error message is lazy in my opinion. It is very generic. Maybe in the future it will say something like "Update not allowed with filtering. Rather use the EntityKey."

    For interest sake - if you create a custom entity with an EntityKey that is not unique and try to update a record that violates the key you will get the same error. For example create a DE of DirPartyTable and make the key DirPartyTable.Name, create two parties with the same name and then try to update one of them with the DE EntityKey.

  • Suggested answer
    Sumit Loya Profile Picture
    2,230 on at
    RE: Delete sales order using Odata / API

    Hi Ali, you are correct. There will be a possibility that same sales order number exists in more than one legal entity in D365 and the rows returned can be more than one.

  • Verified answer
    Ali J Profile Picture
    50 on at
    RE: Delete sales order using Odata / API

    I just found the issue 
    I should use the following link for the delete request 


    {{baseURL}}/data/SalesOrderHeaders(SalesOrderNumber ='xxx',dataAreaId='xxx')

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,145 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,896 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans