Notifications
Announcements
No record found.
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 just found the issue I should use the following link for the delete request
{{baseURL}}/data/SalesOrderHeaders(SalesOrderNumber ='xxx',dataAreaId='xxx')
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.
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.
Congratulations to a top community star!
In our never-ending quest to help the Dynamics 365 Community members get answers faster …
Welcome to the next edition of the Community Platform Update. This is a status …
Stay up to date on forum activity by subscribing.