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
Hope this helps
[View:https://youtu.be/TSQiE42tDwU:320:240]
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.
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.'; } } } } }
api.businesscentral.dynamics.com/.../ZYNewSalesOrders(Document_Type='Order',No='101001')
Hope this can give you some hints.
Thanks.
ZHU
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,134 Super User 2024 Season 2
Martin Dráb 229,928 Most Valuable Professional
nmaenpaa 101,156