Answers.Body: <p>I had the exact same need last week!  I'm attaching a screenshot from SearchKit, though you probably need something simpler.  But crucially:</p>
  <ul>
  <li><em>Contact Related Contacts</em> is what you're looking for (see screenshot item 1). You can specify the relationship type.</li>
  <li>You can create a smart group from the <strong>Add</strong> button (item 2).</li>
  <li>You can see I also am filtering here on organizations whose membership end date is in the past.</li>
  </ul>
  <p>What's odd is that I used the CID of the org, and it <em>did</em> work.  We needed this so the payment was associated with the org, not the primary contact.  I used <a href="https://lab.civicrm.org/extensions/sktokens#getting-started" rel="nofollow noreferrer">SearchKit Tokens</a> to create a &quot;Organization's CID&quot; and &quot;Organization's Membership Type&quot; token for individuals.  We didn't use checksums because these users have to log in to renew.  We send them to a FormBuilder page though - which in turn redirected to a contribution page, so maybe that's why it worked.</p>
  <p><a href="https://i.sstatic.net/3Bser.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3Bser.png" alt="enter image description here" /></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-19T17:12:07.677Z
Answers.Text: Thank you @jon-g-megaphone-tech That was very helpful, but I'm still not managing to limit it to primary contacts. I wonder if you might take a look at my updated question and offer additional thoughts.
Answers.UserDisplayName: kapn
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-21T22:43:23.513Z
Answers.Text: @kapn Your relationship join is set to "With (optional)".  Set it to "With (required)"?
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-19T16:30:09.880Z
Answers.LastActivityDate: 2024-01-19T16:30:09.880Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I have a group of contacts that are organizations. They are institutional members of the organization I'm working for. That part works fine. We are trying to send a renewal email and the normal way to do this seems to be using the &quot;on behalf of&quot; option on the contribution page. All that works as expected. It fails if I arrive with a CID and checksum that makes me the org, but succeeds if I arrive with a CID and checksum that makes me a related contact. All well and good.</p>
  <p>I have created an &quot;Primary contact for&quot; relationship for each org so I don't email every single person related to an organization. It seemed a simple enough solution, but I can't find a way to make a smart group that captures the primary contacts of a group of organizations.</p>
  <p>I started with Search Builder as it appeals to my brain. I failed as I can't find relationships exposed anywhere in this tool.</p>
  <p>I can use Advanced Search to find individuals who are primary contacts, but not just the primary contacts whose organizations are in a particular group or have a particular membership status.</p>
  <p>I have attempted to make use of Jon G's SearchKit suggestion, but am still getting stuck with variations of the relationship problem.</p>
  <p>I have replicated what he suggested and do get results that seem initially promising, but there are too many to possibly be just the primary contacts for these orgs (there are only 75 primary contacts in total) and indeed the first entry in the list is not a primary contact for anyone.</p>
  <p><a href="https://i.sstatic.net/4BAWm.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4BAWm.png" alt="enter image description here" /></a></p>
  <p>I then tried to add a filter at right to limit the results to primary contacts only. The right options seemed to be available, but now the results set is empty.</p>
  <p><a href="https://i.sstatic.net/mCbAN.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mCbAN.png" alt="enter image description here" /></a></p>
  <p>I would appreciate any further thoughts to augment my admittedly poor grasp of SearchKit.</p>
  
Tags: <relationships><smartgroups>
Title: using relationships to create a (smart) group from another group
ThreadText: # using relationships to create a (smart) group from another group
  
  (Asked by: username_0 on 2024-01-18)
  
  I have a group of contacts that are organizations. They are institutional members of the organization I'm working for. That part works fine. We are trying to send a renewal email and the normal way to do this seems to be using the "on behalf of" option on the contribution page. All that works as expected. It fails if I arrive with a CID and checksum that makes me the org, but succeeds if I arrive with a CID and checksum that makes me a related contact. All well and good.
  
  I have created an "Primary contact for" relationship for each org so I don't email every single person related to an organization. It seemed a simple enough solution, but I can't find a way to make a smart group that captures the primary contacts of a group of organizations.
  
  I started with Search Builder as it appeals to my brain. I failed as I can't find relationships exposed anywhere in this tool.
  
  I can use Advanced Search to find individuals who are primary contacts, but not just the primary contacts whose organizations are in a particular group or have a particular membership status.
  
  I have attempted to make use of Jon G's SearchKit suggestion, but am still getting stuck with variations of the relationship problem.
  
  I have replicated what he suggested and do get results that seem initially promising, but there are too many to possibly be just the primary contacts for these orgs (there are only 75 primary contacts in total) and indeed the first entry in the list is not a primary contact for anyone.
  
  [![enter image description here](https://i.sstatic.net/4BAWm.png)](https://i.sstatic.net/4BAWm.png)
  
  I then tried to add a filter at right to limit the results to primary contacts only. The right options seemed to be available, but now the results set is empty.
  
  [![enter image description here](https://i.sstatic.net/mCbAN.png)](https://i.sstatic.net/mCbAN.png)
  
  I would appreciate any further thoughts to augment my admittedly poor grasp of SearchKit.
  
  **Tags:** relationships, smartgroups
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-01-19. Score: 1 | Accepted answer
  
  I had the exact same need last week! I'm attaching a screenshot from SearchKit, though you probably need something simpler. But crucially:
  
  * *Contact Related Contacts* is what you're looking for (see screenshot item 1). You can specify the relationship type.
  * You can create a smart group from the **Add** button (item 2).
  * You can see I also am filtering here on organizations whose membership end date is in the past.
  
  What's odd is that I used the CID of the org, and it *did* work. We needed this so the payment was associated with the org, not the primary contact. I used [SearchKit Tokens](https://lab.civicrm.org/extensions/sktokens#getting-started) to create a "Organization's CID" and "Organization's Membership Type" token for individuals. We didn't use checksums because these users have to log in to renew. We send them to a FormBuilder page though - which in turn redirected to a contribution page, so maybe that's why it worked.
  
  [![enter image description here](https://i.sstatic.net/3Bser.png)](https://i.sstatic.net/3Bser.png)
  
  > **Comments:**
  > **username_0**: Thank you @jon-g-megaphone-tech That was very helpful, but I'm still not managing to limit it to primary contacts. I wonder if you might take a look at my updated question and offer additional thoughts.  
  > **username_1**: @username_0 Your relationship join is set to "With (optional)".  Set it to "With (required)"?  
  
  ---
  
  