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 :
Dynamics 365 Community / Forums / Finance forum / Delete sales order usi...
Finance forum

Delete sales order using Odata / API

(0) ShareShare
ReportReport
Posted on by 52

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

I have the same question (0)
  • Verified answer
    Ali J Profile Picture
    52 on at

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


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

  • Suggested answer
    Sumit Loya Profile Picture
    2,230 on at

    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.

  • Suggested answer
    Pete Alberts Profile Picture
    3,542 on at

    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.

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 > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans