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

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

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)
  • Nilesh Gajjar India Profile Picture
    2 on at
    RE: Updating a Sales Order Line using OData web services

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

  • Daniel B. Sigurgeirsson Profile Picture
    29 on at
    RE: Updating a Sales Order Line using OData web services

    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

  • LuisRodrigues Profile Picture
    5 on at
    RE: Updating a Sales Order Line using OData web services

    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
    RE: Updating a Sales Order Line using OData web services

    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.

  • Suggested answer
    RockwithNav Profile Picture
    7,952 Super User 2025 Season 2 on at
  • Daniel B. Sigurgeirsson Profile Picture
    29 on at
    RE: Updating a Sales Order Line using OData web services

    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."

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans