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 :
Small and medium business | Business Central, N...
Suggested answer

Errors trying to update Purchase Order via OData

(0) ShareShare
ReportReport
Posted on by 5

Hoping someone can give me a pointer on this.

Using Business Central Dynamics (hosted by MS), trying to update a Purchase Order custom field via a PUT or PATCH call with OData.

The field I am trying to update is a custom field we have added to the Purchase Order.  I have created the OData server page for the Purchase Order page and the field is present in the results if I do a GET on the page.

The url I am calling is:

api.businesscentral.dynamics.com/.../<tenanat id>/<environment>/ODataV4/Company('<company name>')/PurchaseOrderPage?$filter=No eq '10201'

The json I am passing in is:

{ "Date_Sent_to_Vendor": 2023-05-01}

I have added the following headers to the call:

Content-Type : application/json

If-Match : W/"JzIwOzEzMjk3OTM3ODUwODE3MzIxMzM4MTswMDsn"

I do a GET right before the PATCH call to get the current eTag value to place in the If-Match header.

I am getting the dreaded:

'PATCH' requests for 'PurchaseOrderPage' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services.

I have read all the other threads about making sure the If-Match is there with the current eTag but I am not able to get past this.  All the other examples I have seen are for updating standard fields but nothing on updating a custom field.

Any help or advice would be greatly appreciated!

Thanks!

Bruce

I have the same question (0)
  • Suggested answer
    Saurav.Dhyani Profile Picture
    14,330 Super User 2025 Season 2 on at
    RE: Errors trying to update Purchase Order via OData

    Hope this helps

    [View:https://youtu.be/TSQiE42tDwU:320:240]

  • Suggested answer
    YUN ZHU Profile Picture
    90,632 Super User 2025 Season 2 on at
    RE: Errors trying to update Purchase Order via OData

    Hi, Similar to the following question.

       

    But please note that if you publish a standard Purchase Order list, it cannot be edited, and the following error may appear.

    pastedimage1684889901635v2.png

    If you insist on using Odata, I suggest you create a new page.

    Below is a simple example of a Sales Order.

    page 50011 "ZY Sales Orders"
    {
        ApplicationArea = All;
        Caption = 'ZY Sales Orders';
        PageType = List;
        SourceTable = "Sales Header";
        UsageCategory = Lists;
    
        layout
        {
            area(content)
            {
                repeater(General)
                {
                    field("Document Type"; Rec."Document Type")
                    {
                        ToolTip = 'Specifies the value of the Document Type field.';
                    }
                    field("No."; Rec."No.")
                    {
                        ToolTip = 'Specifies the number of the estimate.';
                    }
                    field("Sell-to Customer No."; Rec."Sell-to Customer No.")
                    {
                        ToolTip = 'Specifies the number of the customer associated with the sales return.';
                    }
                    field("Posting Date"; Rec."Posting Date")
                    {
                        ToolTip = 'Specifies the date when the sales document was posted.';
                    }
                    field("Ship-to Code"; Rec."Ship-to Code")
                    {
                        ToolTip = 'Specifies the code for another shipment address than the customer''s own address, which is entered by default.';
                    }
                }
            }
        }
    }
    

    pastedimage1684889925520v3.png

    api.businesscentral.dynamics.com/.../ZYNewSalesOrders(Document_Type='Order',No='101001')

    pastedimage1684889941807v4.png

    pastedimage1684889955771v5.png

    pastedimage1684889977611v6.png

    Hope this can give you some hints.

    Thanks.

    ZHU

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sumit Singh Profile Picture

Sumit Singh 2,857

#2
Sohail Ahmed Profile Picture

Sohail Ahmed 2,687 Super User 2025 Season 2

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,203

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans