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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Answered

updating a ProductionOrderHeader using oData

(0) ShareShare
ReportReport
Posted on by 5

I am trying to update a ProductionOrderHeader entity using odata. All the documentation talks about how to create a patch request to the odata endpoint that references the exact entity I am interested like so:

<our instance>/data/ProductionOrderHeader(<uniqueparameter>).. How does one get that <uniqueparameter> value? I can do a regular GET and use a filter to get the ProductionOrderHeader that I want:

<our instance>/data/ProductionOrderHeader?$filter=(ProductionOrderNumber eq 'Prod-000139') but in the returned Json I don't see anything to use for a unique id for this header. Now all I get back from my PATCH call is a "More than one resource was found when selecting for update" error.

An example would help a lot here. I am using node.js / axios to create the PATCH request

I have the same question (0)
  • Verified answer
    WillWU Profile Picture
    22,361 on at

    Hi pkraakman,

    Please don't use "eq".

    1. The entity key must match the entity key on the data entity.

    2. If the savedatPerCompany is set to yes then you must include the dataAreaId in your TAG else you must leave it out.

    Please check. e.g URL/customerV3(CustAccount='DE-001',dataAreaId='usmf')

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi pkraakman,

    1. When you are using get a request to get data via oData, data is fetch only from the default company assigned to the user associated with Azure application in F&O. If you want to select data across all companies you need to use a parameter cross-company, for example

    GET https://hosty/data/ProductionOrderHeaders?$filter=ProductionOrderNumber eq 'BRMF-000001'&cross-company=true

    2. Patch request requires a list of fields used in entity key as unique key and the list of field-value pair in the body. Also, cross-company needed to be used if production order is located in the company different from default company for the user assigned with Azure application

    PATCH https://host/data/ProductionOrderHeaders(dataAreaId='brmf',ProductionOrderNumber='BRMF-000001')?cross-company=true
    
    Body
    {"ProductionOrderName":"test"}

  • pkraakman Profile Picture
    5 on at

    Thank you that worked for getting the call to work. As a follow up to this I now get the message that the productionOrderHeader is in a Scheduled status and can only be updated while in a Created status. Can I change the status using oData? if so what parameter should I pass in the ProductionOrderStatus json variable because it will not take a string as its value.

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi pkraakman,

    Production statuses are changed via operation in F&O and it's not a good idea just to change the value in the table and the standard entity will not allow you to do this. If I remember correctly it's a bug (or maybe feature) of the standard entity and from UI data can be changed in scheduled status. I recommend you to double-check the behavior with the F&O consultant and if needed create a copy of the standard entity that allows the change in status Scheduled also, or try to fix the standard entity.

  • Aparisi82 Profile Picture
    2,188 on at

    Standard D365 , you can only amend production/batch orders if their status is created.

    It implies that the data entity does not cope with estimation/scheduling/release.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
Laurens vd Tang Profile Picture

Laurens vd Tang 301 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 118 Super User 2025 Season 2

#3
Siv Sagar Profile Picture

Siv Sagar 105 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans