I am doing something not standard, but I have to do.
I am gonna update CRM365 database from previous backup; with a query.
I had created two custom entity.
One named service.
Another named service name.
Service name is look up in service entity; so it has 1:N relationship with service entity.
The relation was referential.
Unfortunately a client had delete access and has deleted the two record of Service name entity.
Likewise Service name look up field of every records of Service that had those two deleted records are null now !
Now when write update query between two databases and two tables it return me :
The UPDATE statement conflicted with the FOREIGN KEY constraint "reltion_name". The conflict occurred in database "x", table "service_nameBase", column 'service_namesId'.I query the extentionbase table of related entity,which is service and update that with column of my backup database.
I have created a test environment and do my works there.
As I run the query it gives me the above error.
I googled and find out this is because of relation between them.
The primary key of the Service Name is the foreign key of the Service.
How can I solve this problem?
I changed relation between them from referential to configurable cascading and set all configuration to cascade all.
But no success.
I know that this job is not recommended, But as I said I have to.
These two entities are both custom and non-system entity.Any help will appreciate.