Community
Showing results for 
Search instead for 
Do you mean 
Reply

Error: The INSERT statement conflicted with the FOREIGN KEY constraint PHONE_PHONEMASKID_FK

Highlighted
Moderator
Posts: 455
Country: United_Kingdom

Re: Error: The INSERT statement conflicted with the FOREIGN KEY constraint PHONE_PHONEMASKID_FK

It does appear that it is correctly sitting on the PC you are using. It maybe required to detach and reattach the database to get this correctly working again.

 

Again I would like to ensure you have a recent backup taken before proceeding with this step. the article guides on using Actdiag to detach and provides a separate article on reattaching.

 

14620 How to detach an Act! database from the Microsoft SQL Server (ACT7) instance

 

As an alternative it maybe worth to restoring a copy of the database to work on and test further.

Highlighted
Tuned Listener
Posts: 112
Country: United_Kingdom

Re: Error: The INSERT statement conflicted with the FOREIGN KEY constraint PHONE_PHONEMASKID_FK

That still didn't work - same non-local database error.

 

Also, in the Country defined fields the default Country is once again greyed out.

 

Highlighted
Moderator
Posts: 455
Country: United_Kingdom

Re: Error: The INSERT statement conflicted with the FOREIGN KEY constraint PHONE_PHONEMASKID_FK

At this point I would restore a backup of the database using 'File > Restore > Database > Restore As' 

Once you have the backup can you test to see if the issue is still present and if it is attempt to create an empty copy of the database.

 

If this allows an empty copy to be created we can then test the earlier theory.

Highlighted
Tuned Listener
Posts: 112
Country: United_Kingdom

Re: Error: The INSERT statement conflicted with the FOREIGN KEY constraint PHONE_PHONEMASKID_FK

Thanks. Did both those actions.

New empty database still has US as default phone/mobile and the the Country defined fields the default Country is greyed out.

Haven't tried reschema - should I? Or something else?

Highlighted
Silver Contributor
Posts: 1,965
Country: United_Kingdom

Re: Error: The INSERT statement conflicted with the FOREIGN KEY constraint PHONE_PHONEMASKID_FK

If you can I would suggest you restore a previous backup using the restore as option giving it a new name.

 

Once restored open your corrupted database, lookup all items using the edit date in contacts since the backup and then export to the restored database.

 

This should get you back to a stable and up-to-date database.

Highlighted
Tuned Listener
Posts: 112
Country: United_Kingdom

Re: Error: The INSERT statement conflicted with the FOREIGN KEY constraint PHONE_PHONEMASKID_FK

This problem (wrong country phones) has been with us for a while so all backups would have the same issue - as does the new restore>save as>empty database.
Highlighted
Moderator
Posts: 455
Country: United_Kingdom

Re: Error: The INSERT statement conflicted with the FOREIGN KEY constraint PHONE_PHONEMASKID_FK

[ Edited ]

@TZAL wrote:

"the Country defined fields the default Country is greyed out."


Could you clarify what is meant here? as i am unsure where to look.

 

The country code should be pulled from the creating Users country. Can I confirm if you go to 'Lookup > My Record' that you contact has the desired country chosen.

 

Highlighted
Tuned Listener
Posts: 112
Country: United_Kingdom

Re: Error: The INSERT statement conflicted with the FOREIGN KEY constraint PHONE_PHONEMASKID_FK

Sorry if it's confusing. 

 

Greyed out default country field in Tools > Define fields> Country > Default Value (optional).

 

 

Issues with database are:

 

  1. My Record Country is UK but default phone & mobile country code is now US.
  2. Greyed out default country field (in Tools > Define fields> Country > Default Value (optional)
  3. Showing as non-local even though it's on the PC

Have tried all your suggestions:

 

  • Reschema
  • Save as
  • Detach/re-attach
  • Restore from 

New 'test empty copy database' still has issue  1-2 but issue 3 has gone.

 

This all started following changing some fields from Character to Initial Caps (as described in initial post).

 

So not sure what to do?

Highlighted
Tuned Listener
Posts: 112
Country: United_Kingdom

Re: Error: The INSERT statement conflicted with the FOREIGN KEY constraint PHONE_PHONEMASKID_FK

Greyed out default country field.png

Highlighted
Moderator
Posts: 455
Country: United_Kingdom

Re: Error: The INSERT statement conflicted with the FOREIGN KEY constraint PHONE_PHONEMASKID_FK

I believe the Country's default value being greyed out is working as designed as some System fields doing prevent you from entering default values.

On your own contact as well as having UK selected as the country can i confirm your country code is set to UK?

 

Do you happen to recall the field that you had changed to Initial Caps? if this was a system field it potentially could of cause damage to the structure of the database.