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 NAV (Archived)
Suggested Answer

Updating a Sales Order Line using OData web services

(0) ShareShare
ReportReport
Posted on by 29

Hi,

I would like to update individual sales order lines by using the OData web services. I can successfully retrieve said sales order lines from the following url:

(path-to-odata-web-service)/SalesOrder/(Document_Type='Order',No='some-sales-order-id')/SalesOrderSalesLines

but when I try to issue a PUT request to this url I get the following error:

"'PUT' requests for 'SalesOrderSalesLines' of EdmType 'Collection' are not allowed within Microsoft Dynamics NAV OData web services."

I've already included the correct "If-Match" ETag header in the request.

Any ideas?

Regards,

Daníel

*This post is locked for comments

I have the same question (0)
  • Daniel B. Sigurgeirsson Profile Picture
    29 on at

    Update: I've also tried issuing a PATCH request to the same url, this gives me a slightly different error:

    "'PATCH' requests for 'SalesOrderSalesLines' of EdmType 'Collection' are not allowed within Microsoft Dynamics NAV OData web services."

  • Suggested answer
    RockwithNav Profile Picture
    9,042 Super User 2026 Season 1 on at
  • Daniel B. Sigurgeirsson Profile Picture
    29 on at

    The problem I had was that I wasn't referring to a single entity in the URL, i.e. I had to append the following to the url:

    (Document_Type='Order',Document_No='SP123456', Line_No=10000)

    By reading the $metadata document, we could determine which of the properties in the Sales Order Lines objects combined are the key to the object, and these must be in the URL.

    At least this allows me to issue a PUT/PATCH request to the url. However, I'm receiving another error now: 

    Another user has already changed the record

    which is not the case, I'm the only user. I'm passing the ETag in the If-Match header, and I'm fetching the order line records just moments before I issue the request so I've definitely got the latest ETag value. Still trying to figure out what is causing this error.

  • LuisRodrigues Profile Picture
    5 on at

    Hi Daniel,

    I'm experiencing the same issue when trying to PUT Dimensions against an existing Sales Line that I've previously created.

    Did you get any further with this problem or a potential solution?

    Thanks,

    Luis

  • Daniel B. Sigurgeirsson Profile Picture
    29 on at

    Hi,

    (I had written another reply previously, but that was targeted towards another post I had created earlier this week, and was thus irrelevant)

    Yes I managed to get this working.

    As stated above, then in order to be able to issue a PUT request, I had to include all primary keys for the given table I was saving data to. I.e.: the values for the primary key columns had to be present BOTH in the request body, AND in the URL.

    Also, one must take care of formatting the ETag correctly. It probably helps to learn about strong vs. weak ETags, i.e. sometimes the ETag is wrapped in an "envelope", which is basically the following: W/"actual-e-tag", sometimes there are single quotes there as well.

    Hope this helps,

    Daníel

  • Nilesh Gajjar India Profile Picture
    22 on at

    Check this ticket for solution

    I have face the same issue and found solution

    community.dynamics.com/.../patch-requests-for-of-edmtype-collection-are-not-allowed-within-dynamics-365-business-central-odata-web-services

    Enjoy !!!

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 NAV (Archived)

#1
TAHER_El_Mehdi Profile Picture

TAHER_El_Mehdi 2

#1
sliderxb Profile Picture

sliderxb 2

#1
broberts Profile Picture

broberts 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans