Answers.Body: <p>To add to Erik answer: the contact_sub_type field contains an aggregation of all its sub types, with a "hidden" separators ^A, if you want to modify the subtype directly,</p>
  
  <pre><code>update civicrm_contact set contact_sub_type=concat(char(01),"EXAMPLE",char(01)) where ...
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-27T08:43:01.337Z
Answers.LastActivityDate: 2019-03-27T08:43:01.337Z
Answers.UserDisplayName: Xavier
Answers.Body: <p>You could change clean out all the contact_sub_types of the relevant contacts directly in the DB with an SQL Query. That would be something like:</p>
  
  <pre><code>SELECT * FROM civicrm_contact WHERE contact_sub_type IS NOT NULL AND contact_sub_type NOT IN (SELECT name FROM civicrm_contact_type)
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-03T08:39:45.750Z
Answers.LastActivityDate: 2019-01-03T08:39:45.750Z
Answers.UserDisplayName: ErikH - CiviCooP
Body: <p>I am getting an error Invalid Filter error when trying to open a contact that was configured with a contact type that has since been deleted. The contacts are returned in the search but I am unable to open. Is there a way to restore the contacts without having to manually re-enter each contact or restoring a backup of the database? </p>
  
Tags: <contacts><custom-fields><contact-types>
Title: How do you restore contacts that have a deleted custom contact type?
ThreadText: # How do you restore contacts that have a deleted custom contact type?
  
  (Asked by: username_0 on 2019-01-02)
  
  I am getting an error Invalid Filter error when trying to open a contact that was configured with a contact type that has since been deleted. The contacts are returned in the search but I am unable to open. Is there a way to restore the contacts without having to manually re-enter each contact or restoring a backup of the database?
  
  **Tags:** contacts, custom-fields, contact-types
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-03-27. Score: 1
  
  To add to Erik answer: the contact_sub_type field contains an aggregation of all its sub types, with a "hidden" separators ^A, if you want to modify the subtype directly,
  update civicrm_contact set contact_sub_type=concat(char(01),"EXAMPLE",char(01)) where ...
  
  
  ---
  
  ### Answer by username_2 on 2019-01-03. Score: 1
  
  You could change clean out all the contact_sub_types of the relevant contacts directly in the DB with an SQL Query. That would be something like:
  SELECT * FROM civicrm_contact WHERE contact_sub_type IS NOT NULL AND contact_sub_type NOT IN (SELECT name FROM civicrm_contact_type)
  
  
  ---
  
  