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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Suggested Answer

How to find the composite key of an entity for odata query purposes?

(0) ShareShare
ReportReport
Posted on by 62

I'm trying to find the composite key of an extended F&O entity named ExpEcoResReleasedProductVariants. There are 3 pieces to the screenshot below:

  1. (top-left) The source/parent of the entity extension is EcoResReleasedProductVariant and you can see the keys.
  2. (bottom-left) You can see the keys for the custom entity ExpEcoResReleasedProductVariants.
  3. (right-center) You can see that ExpEcoResReleasedProductVariants really does exist and contains records. I can query these records via browser GET using filter syntax, but I must have key syntax in order to do PATCH operations against the entity.

HF.png

A PATCH operation against F&O odata is required to be structured like this:

/data/ExpEcoResReleasedProductVariants(ProductMasterNumber='243-1001',ProductConfigurationId='000377',ProductSizeId='',ProductColorId='',ProductStyleId='')

I have also tried the following permutations:

/data/ExpEcoResReleasedProductVariants(ProductMasterNumber='243-1001',ProductConfigurationId='000377',ProductSizeId='',ProductColorId='',ProductStyleId='',ItemNumber='243-1001')

/data/ExpEcoResReleasedProductVariants(ProductMasterNumber='243-1001',ProductConfigurationId='000377',ProductSizeId='',ProductColorId='',ProductStyleId='',ItemNumber='243-1001',ProductMasterNumber='243-1001')

I have tried various combinations and permutations of what you see above, but in all cases I get errors like this:

<Error>

<Message>No HTTP resource was found that matches the request URI 'https://***.sandbox.operations.dynamics.com/data/ExpEcoResReleasedProductVariants(ProductMasterNumber='243-1001',ProductConfigurationId='000377',ProductStyleId='',ProductSizeId='',ProductColorId='',ItemNumber='243-1001')'. No route data was found for this request.</Message>
</Error>
How can I find the correct composite key so I can structure the odata request correctly so I can perform a PATCH against it? Note: The URL structure above will perform a valid GET and show data like in the screenshot, when it is correct. As mentioned, the screenshot above displays good data from an odata GET only by using filter syntax, not by using "composite key" syntax. For example:
/data/ExpEcoResReleasedProductVariants?$filter=ProductMasterNumber eq '243-1001' and ProductConfigurationId eq '000377'
What the AOT shows for keys is apparently not correct, else it would work.
I have downloaded /data/$metadata and that gives me a ton of data, but the keys for ExpEcoResReleasedProductVariants are not listed. In most cases, entity keys are listed in that metadata dump, but this one isn't.
There must be some solid way to know how to construct an F&O odata query using composite key patch syntax with the correct key attributes. How can it be found?
Thanks in advance for any help.

I have the same question (0)
  • HerrimanCoder Profile Picture
    62 on at

    I forgot to mention that I had also tried:

    /data/ExpEcoResReleasedProductVariants(ItemNumber='243-1001',ProductMasterNumber='243-1001')

    ...but that doesn't work either. No surprise, not enough attributes to guarantee uniqueness in the record.

  • Suggested answer
    Martin Dráb Profile Picture
    239,660 Most Valuable Professional on at

    It's not clear to me why you tried all the other options if you know that the entity key is ItemNumber + ProductMasterNumber. What you're missing in your last attempt is the identification of the legal entity: the DataAreaId field (as the first field in the request).

  • HerrimanCoder Profile Picture
    62 on at

    I had tried that as well. It doesn't work.

  • Suggested answer
    grkonda Profile Picture
    2 on at
    Not sure if this is resolved already but I did face the same issue and solution is:
    ExpEcoResReleasedProductVariants(ProductMasterNumber='PRD-10001',ProductConfigurationId='',ProductSizeId='',ProductColorId='',ProductStyleId='A1',ProductVersionId='')
     
    Though ProductVersionId is not part of the composite primary key, it still expected as part of the PATCH url. This worked fine for me
     
  • Martin Dráb Profile Picture
    239,660 Most Valuable Professional on at
    I've just noticed that the screenshot shows the entity key of a wrong entity. HerrimanCoder claimed that we can see the keys for the custom entity ExpEcoResReleasedProductVariants, but it's not true. The screenshot shows EcoResReleasedProductVariantEntity; it doesn't tells us anything about the custom entity.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 142 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 102 Super User 2026 Season 1

#3
Laurens vd Tang Profile Picture

Laurens vd Tang 101 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans