Forum Discussion

th_ge's avatar
th_ge
Frequent Visitor
9 years ago
Solved

Duplicate key quote entity Dynamics CRM

Hi   In my report I added a OData data source which connects an on premise Dynamics CRM. When I try to add the quote entity as a query there is the following error:         I guess that ...
  • th_ge's avatar
    9 years ago

    The solution for the problem is to add filter and select statements directly in the OData request. When you select the quote entity in the user interface, the M expression in the advanced editor looks like this:

     

    let
        Source = OData.Feed("https://<SERVERURL>/<ORGANIZATION>/api/data/v8.0/"),
        quotes_table = Source{[Name="quotes",Signature="table"]}[Data]   
    in
        quotes_table

     

    The following M expression shows how to filter the OData query directly:

     

    let   
        Source = OData.Feed("https://<SERVERURL>/<ORGANIZATION>/api/data/v8.0/quotes?$select=quoteid,createdon,_createdby_value,statecode"),
        quotes_table = Table.SelectColumns(Source,{"quoteid","_createdby_value","statecode"})
    in
        quotes_table

     

    With this procedure you simply select the columns you really need and therefore we can avoid the error with duplicate keys.