Normally I can figure out the (sometimes composite) primary key for an F&O entity, but so far I have had no luck finding the key for any of these entities:
ItemSpecificBillOfMaterialsHeaders
ItemSpecificBillOfMaterialsHeadersV2
ItemSpecificBillOfMaterialsHeadersV3
A sample record looks like this:
{
"dataAreaId":"xyz",
"BOMId":"BOM_00000001",
"ManufacturedItemNumber":"SM-HC9578-002A",
"ProductionSiteId":"01",
"ProductColorId":"",
"ProductConfigurationId":"",
"ProductSizeId":"",
"ProductStyleId":"",
"BOMName":"HC9578-002A",
"IsActive":"Yes",
"ApproverPersonnelNumber":"000013",
"IsApproved":"Yes",
"EngChgEngineeringBomReference":"",
"EngChgEngineeringVersion":""
}
Odata URL for above record:
/data/ItemSpecificBillOfMaterialsHeaders?$top=1
For simple GET queries I can always use $filter to get what I need; but in this case I need to do a PATCH update, and thus I need the exact primary key.
I queried the metadata thusly:
/data/$metadata
...and that brought a torrent of json data. Yes, I did find all 3 entities mentioned above, but the info it's giving me is certainly not the primary key(s). For example:
<NavigationProperty Name="ItemSpecificBillOfMaterialsHeaders" Type="Collection(Microsoft.Dynamics.DataEntities.ItemSpecificBillOfMaterialsHeader)" Partner="ProductionSite">
<ReferentialConstraint Property="SiteId" ReferencedProperty="ProductionSiteId" />
<ReferentialConstraint Property="dataAreaId" ReferencedProperty="dataAreaId" />
</NavigationProperty>
Those 2 properties SiteId and dataAreadId are the same in most records--not even close to unique.
So I have been using the trial-and-error method, such as:
- /data/ItemSpecificBillOfMaterialsHeaders(dataAreaId='hoft',BOMId='HOFT-006037',ManufacturedItemNumber='344-25SW')
- /data/ItemSpecificBillOfMaterialsHeaders(BOMId='HOFT-006037')
- /data/ItemSpecificBillOfMaterialsHeaders(BOMId='HOFT-006037',ManufacturedItemNumber='344-25SW')
In all cases I get back this error:
<Error>
</Error>
There must be a way in F&O to look up the primary key of an entity so that a PATCH request can be done against it. How is it done?