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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Import Solution Failed - Foreign Key Constraint

(0) ShareShare
ReportReport
Posted on by 20

Hello, I'm trying to export a custom entity from production to sandbox, and it fails to import on System Views with the following message:

The INSERT statement conflicted with the FOREIGN KEY constraint "owner_userquerys". The conflict occurred in database "Sandbox_MSCRM", table "dbo.OwnerBase", column 'OwnerId'. The statement has been terminated.

The entity does not already exist at all in the Sandbox environment, and the solution is unmanaged. If anyone knows anything that could help me, that would be great, thank you

  • Community Member Profile Picture
    on at

    Hi,

    I think you create a saved query in sandbox with certain user which not exists in Production environment.

    try to remove the saved query and import again or , change the owner of saved query from current owner to one exist in production

  • Suggested answer
    Kenneth Ariel Chaves Herrera Profile Picture
    Microsoft Employee on at

    Hi Michelle C I hope you are doing good.

    You could try defining an alternative key for the custom entity so then the conflict between entities should be solve. Here more documentation that can be useful:

    Define alternate keys for an entity (Developer Guide for Dynamics 365 Customer Engagement (on-premises)) | Microsoft Docs

    If this answers your question, please check it as verified.

    Welcome to this amazing community.

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 Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Syed Aqib Raza Profile Picture

Syed Aqib Raza 96

#2
11manish Profile Picture

11manish 90 Super User 2026 Season 2

#3
ParthPatel249 Profile Picture

ParthPatel249 80

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans