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

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Error in synchronization in integration from dataverse

(2) ShareShare
ReportReport
Posted on by 141
I have set up dataverse connection in business central which was a success.
 
However, when i am syncing customer integration from integration table mapping page, i am getting following error.
 

An error occurred when communicating with Dataverse.

Detailed description: Unable to cast object of type 'Microsoft.Xrm.Sdk.Entity' to type 'Microsoft.Xrm.Sdk.EntityReference'.
 
 
How this can be resolved.
 
 
 
 
 
Thanks
 
I have the same question (0)
  • Suggested answer
    DAnny3211 Profile Picture
    11,369 on at
    Error in synchronization in integration from dataverse

    Hi Ahsan,

    Thanks for sharing the details! The error you're encountering:

    "Unable to cast object of type 'Microsoft.Xrm.Sdk.Entity' to type 'Microsoft.Xrm.Sdk.EntityReference'"

    typically occurs when a field in the Dataverse entity is expected to be a lookup (EntityReference) but is instead being treated as a full Entity object.

    Here's how you can troubleshoot and resolve this:

    1. Check Field Mappings:

      • Go to the Integration Field Mapping for the CUSTOMER table.
      • Look for any fields that are mapped to lookup fields in Dataverse (e.g., PrimaryContactId, OwnerId, etc.).
      • Ensure that these fields are correctly mapped to EntityReference types in Business Central.
    2. Review the Target Dataverse Schema:

      • In Dataverse, confirm that the target field is indeed a lookup and not a complex object or collection.
      • If the field is a lookup, Business Central should send an EntityReference, not a full Entity.
    3. Update or Remove Problematic Mappings:

      • Temporarily remove or correct the mapping for the field causing the issue.
      • Try syncing again to isolate the problematic field.
    4. Use Logging and Debugging:

      • Enable detailed logging in Business Central to capture the exact field causing the cast error.
      • This can help pinpoint the mismatch.
    5. Check for Customizations:

      • If your Dataverse environment has custom plugins or logic that modifies the expected data types, this could also cause the issue.

    If the issue persists, consider raising a support ticket with Microsoft and include the full mapping configuration and error trace.

    Hope this helps!
    Please mark this response as helpful if it answered your question.

    Best regards!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Sahan Hasitha Profile Picture

Sahan Hasitha 394

#2
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 123

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 106 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans