Forum Discussion

alamp's avatar
alamp
Frequent Visitor
1 year ago
Solved

We cannot convert the value null to type Record

Hi All, I am struggling with the issue of "Cannot convert the value null to type Record".

I am using Businesss central api is to create a report in power bi. I has been working fine from last 2 years and all of a sudden it has started giving this error. This is not letting power bi reports which are connected to business central to refresh. 

 

I have tried multiple solutions but couldn't find the issue. 

I do not have any column with null values and done everything to resolve it. I am using a simple query to just fetch the data. 

 

Below is the error

Data source error: Expression.Error: The OData connector failed with the following error: We cannot convert the value null to type Record... . The exception was raised by the IDbCommand interface. Table: Accounts of Sales
Cluster URI: WABI-US-NORTH-CENTRAL-B-redirect.analysis.windows.net
Time: 2024-09-11 17:25:44Z

9 Replies

  • Hello alamp ZooTV 

    check this solution

    Have you tried the fix on the below link? 
    https://www.reddit.com/r/PowerBI/comments/1f7yadg/data_conversion_error_on_refresh/

    We encountered the same error and by adjusting the 4th parameter on the API call, the problem went away

    Before:
    Dynamics365BusinessCentral.ApiContentsWithOptions(null, null, null, null)

    After:
    Dynamics365BusinessCentral.ApiContentsWithOptions(null, null, null, [UseReadOnlyReplica = null])

    also you can follow the issue to get updated
    https://community.fabric.microsoft.com/t5/Issues/The-OData-connector-failed-with-the-following-error-We-cannot/idc-p/4145261#M109266

     

    • alamp's avatar
      alamp
      Frequent Visitor

      Hi Idrissshatila , Thanks for the response. This is has worked for few of my report but not for all. I have raised a case with MS product team as well. 

      I will update you once i get any permanent solution. 

    • alamp's avatar
      alamp
      Frequent Visitor

      I think this also worked and MS has patched the error now. Few of the reports i didn't changed anything and it's working now. Thanks guys. 

    • RosaPequeno's avatar
      RosaPequeno
      New Member

      Hi Idris, 

       

      thank you for this. 

       

      I have sorted the 15 reports I had already in place. However I am trying to set up a new report from scratch and when I try to select the tables from our ERP (Business Central), I got the same error. In this case I cannot open the table and set up the forth value to  [UseReadOnlyReplica = null]). 
      Any idea how to sort it out?

      • alamp's avatar
        alamp
        Frequent Visitor

        Hi RosaPequeno ,

         

        If possible could just put here the source line of your code or more. 

         

  • ZooTV's avatar
    ZooTV
    Frequent Visitor

    I am having the same issue, which appeared 2-3 days ago..

    The error is:

    "Data source errorExpression.Error: The OData connector failed with the following error: We cannot convert the value null to type Record... . The exception was raised by the IDbCommand interface"

     

    I am able to perform a "Refresh" via the desktop app and re-publish successfully. But the update scheduled within the semantic model continuously fails.
    It also seems to failing on different tables each time.   

    I will keep investigating.

  • alamp's avatar
    alamp
    Frequent Visitor

    Thanks guys for the responses. Managed to resolve for few of the reports but not all. Still looking for permanent solution.