Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Facing Issue while executing OData query to get Invoice Data with Payment and Payment Method.

Posted on by

The below-mentioned query is not working. Can someone help to resolve this issue?

OData Query:

https://<Environment>/api/data/v9.1/invoices?$select=_contactid_value,createdon,datedelivered,description&$expand=salesorderid($select=ordernumber),invoice_details($select=createdon,invoicedetailname,invoiceid),new_invoice_msdyn_payment_invoice($select=createdon,_msdyn_paymentmethod_value;$expand=msdyn_paymentmethod($select=msdyn_name))&$filter=_salesorderid_value eq <GUID> and _contactid_value eq <GUID>

Response:

{
    "error": {
        "code""0x0",
        "message""The navigation property 'msdyn_paymentmethod' cannot be expanded. Only many-to-one relationships are supported for nested expansion."
    }
}
The same query was working fine before.
  • Suggested answer
    RE: Facing Issue while executing OData query to get Invoice Data with Payment and Payment Method.

    Hi,

    Issue is not wrt limit of 10 expands.

    X:1 $expands nested in X:N $expands (which were never supported) previously failed silently, meaning that the data returned by the API was unreliable and did not match the value expected by the client —the request you provided would show this unreliability if the last $select clause was removed.

    This limitation has been shared in public documentation regarding nested $expands since June 27, 2020.

    pastedimage1627531839725v1.png

    For these reasons, we now throw an exception for this unsupported scenario. Remove dependencies on unsupported CDS API requests.

    We are updating our code to reflect the state of previously published documentation and to make it even more apparent to anyone who might have been incorrectly using the unsupported feature.

    Regards,

    Venkatesh N

  • RE: Facing Issue while executing OData query to get Invoice Data with Payment and Payment Method.

    Hello Venkatesh N,

    As I go through the documents there is mentioned that nested expend has no limit but total expend can be up to 10.

    My query is not exceeding the limit of 10 expends.

    The only part of this query is not working is "_msdyn_paymentmethod_value;$expand=msdyn_paymentmethod($select=msdyn_name)" which working fine before in Nov 2020, Dec 2020, Jan 2021, Feb 2021, Mar 2021 and Apr 2021. Why is it not working now??

    Response of query was like:

    "new_invoice_msdyn_payment_invoice": [

                   {

                       "@odata.etag": "W/\"17528565\"",

                       "createdon": "2020-11-12T09:31:07Z",

                      "msdyn_paymentmethod": {

                           "msdyn_name": null,

                           "__DisplayName__": "Credit Card",

                           "IsReferencedQueryCall": true

                       }

                   }

    Is there any issue with the relationship between Payment and Payment Method Entities?

  • Suggested answer
    RE: Facing Issue while executing OData query to get Invoice Data with Payment and Payment Method.

    Hi,

     X:1 $expands nested in X:N $expands previously failed silently by invariably returning a null value for the nested X:1 $expand.

    We now prevent this by throwing an exception explaining that $expands nested in X:N $expands are not supported.


    This has been shared in public documentation regarding nested $expands since June 27, 2020.
    - Documentation: Options to apply to expanded tables
    - Documentation: Multi-level expand of single-valued navigation properties

    pastedimage1627277257555v1.png

    Regards,

    Venkatesh N

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans