Answers.Body: <p>Lack of searchability is one of the downsides to using Contact References.</p>
  
  <p>1) One option is to use Relationships instead of Contact Refs.  You can create a smart group based on those - but you would need to convert your existing Contact Refs and associated processes.</p>
  
  <p>2) Jaap's <a href="https://lab.civicrm.org/extensions/dataprocessor" rel="nofollow noreferrer">DataProcessor</a> extension can help. </p>
  
  <ul>
  <li>Add a Data Source of type Individual - call it Person</li>
  <li>Add a second Data Source of type Individual - call it DC.  
  
  <ul>
  <li>Join type as 'Select fields to join on'</li>
  <li>Join on Field: Contact ID = Person::custom group::DC contact ref</li>
  </ul></li>
  <li>Add fields for the fields you want to display for Person and/or DC using 'Raw field value' - include the DC contact id.</li>
  <li>Add an Output of Contact Search</li>
  </ul>
  
  <p>That will search for contacts who are DC's and show the fields you configure.</p>
  
  <p>Although Contact Search has an action to create a smart group, I have not got that to work with DataProcessor (yet) - so it does not completely solve your problem.  You could though run it and add the found contacts to a static group.</p>
  
  <p>I guess Jaap would welcome any PR's or sponsorship to make smart groups work as a dataprocessor output.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-12T20:05:26.350Z
Answers.Text: Aidans answer is correct. I have been working with two clients who have a membership with a household but the e-mail correspondence is with the head of the household. So in that case I created a data processor to show the head of the households of families with a membership.
Answers.UserDisplayName: Jaap Jansma - CiviCooP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-12T14:11:38.680Z
Answers.LastActivityDate: 2020-05-12T14:11:38.680Z
Answers.UserDisplayName: Aidan
Body: <p>Civi 5.15.1, WordPress 5.4.1</p>
  
  <p>Some of our contacts ask us to send our communications to someone else, a "designated contact" or DC. To accommodate them, we created custom Contact Reference fields for email and phone/text, and for mail we use Civi's built-in "Use another contact's address" feature. To mark someone as a DC, we created a Contact Subtype and a Smart Group based on that subtype. However, new DCs don't come around that often, so our back-end data entry staff haven't consistently remembered to use the subtype. Also, we wouldn't otherwise need the subtype because there are no custom contact fields associated with it. We just need the Smart Group.</p>
  
  <p>So I was hoping to get rid of the unnecessary subtype step, and modify the Smart Group to be comprised of contacts who are the selected values for either of our custom Contact Reference fields or Civi's surrogate address field. I've looked at Advance Search, Search Builder, and the Custom Searches, to no avail. Is such a thing possible? Thanks.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-12T19:09:52.000Z
Comments.Text: what CMS? in case Drupal Views or WP equivalent can sort this. and side question. do these sub contacts have other data that is useful, or is it really only a way of recording the alternative email/address? just wondering if another Location Type might suffice. probably not but ...
Comments.UserDisplayName: petednz - fuzion
Tags: <search><smartgroups><contact-reference>
Title: how to search for contacts selected in contact reference fields
ThreadText: # how to search for contacts selected in contact reference fields
  
  (Asked by: username_0 on 2020-05-07)
  
  Civi 5.15.1, WordPress 5.4.1
  
  Some of our contacts ask us to send our communications to someone else, a "designated contact" or DC. To accommodate them, we created custom Contact Reference fields for email and phone/text, and for mail we use Civi's built-in "Use another contact's address" feature. To mark someone as a DC, we created a Contact Subtype and a Smart Group based on that subtype. However, new DCs don't come around that often, so our back-end data entry staff haven't consistently remembered to use the subtype. Also, we wouldn't otherwise need the subtype because there are no custom contact fields associated with it. We just need the Smart Group.
  
  So I was hoping to get rid of the unnecessary subtype step, and modify the Smart Group to be comprised of contacts who are the selected values for either of our custom Contact Reference fields or Civi's surrogate address field. I've looked at Advance Search, Search Builder, and the Custom Searches, to no avail. Is such a thing possible? Thanks.
  
  **Tags:** search, smartgroups, contact-reference
  
  > **Comments:**
  > **username_1**: what CMS? in case Drupal Views or WP equivalent can sort this. and side question. do these sub contacts have other data that is useful, or is it really only a way of recording the alternative email/address? just wondering if another Location Type might suffice. probably not but ...  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-05-12. Score: 2
  
  Lack of searchability is one of the downsides to using Contact References.
  
  1) One option is to use Relationships instead of Contact Refs. You can create a smart group based on those - but you would need to convert your existing Contact Refs and associated processes.
  
  2) username_3's [DataProcessor](https://lab.civicrm.org/extensions/dataprocessor) extension can help.
  
  * Add a Data Source of type Individual - call it Person
  * Add a second Data Source of type Individual - call it DC.
    + Join type as 'Select fields to join on'
    + Join on Field: Contact ID = Person::custom group::DC contact ref
  * Add fields for the fields you want to display for Person and/or DC using 'Raw field value' - include the DC contact id.
  * Add an Output of Contact Search
  
  That will search for contacts who are DC's and show the fields you configure.
  
  Although Contact Search has an action to create a smart group, I have not got that to work with DataProcessor (yet) - so it does not completely solve your problem. You could though run it and add the found contacts to a static group.
  
  I guess username_3 would welcome any PR's or sponsorship to make smart groups work as a dataprocessor output.
  
  > **Comments:**
  > **username_3**: Aidans answer is correct. I have been working with two clients who have a membership with a household but the e-mail correspondence is with the head of the household. So in that case I created a data processor to show the head of the households of families with a membership.  
  
  ---
  
  