I would like to create a Drupal View showing an organization and several individuals who are related to the organization in different relationships. The wording on the CiviCRM Drupal relationships options is ambiguous, and I am struggling to find clear documentation describing CiviCRM relationships in Drupal Views.

How do I create a View showing several related entities linked to a common entity by distinct relationship types?

3 Answers 3


You can use the relationship section of a view for this. A relationship in a view is a relationship between entities don't confuse it with the relationship you have between contacts.

So you could set up a view relationship starting from contact a (the a side of the civicrm relationship), or from contact b (the b side of the civicrm relationship). This a link to the civicrm relationship entity. When you add this relationship to the view you can define which civicrm relationship type.

The next step is to make a view relationship between the civicrm relationship entity and the contact. This relationship is called CiviCRM Contact, the Contact B, or CiviCRM Contact the Contact A.

Then in the fields section of the view you can add fields based on the entity. You can then say for example I want to use display name of Contact B.

If you are familiar with SQL. A view relationship could be described as a join.


I am not sure from the question whether each relationships is connected to the original contact, or if some might be daisy chained eg Parent to Student to School etc. In case it is the latter, here is a snip from an old forum post which might help


Add DV relationship 1 of type "Connects a contact (as contact A) to a relationship." (eg employer of)

Add DV relationship 2 of type "The contact B" use DV 1 as the 'Relationship'

So you have now connected person X to Org Y


Add DV relationship 3 of type "Connects a contact (as contact A) to a relationship." (eg Primary Contact of) - use DV 2 as the 'Relationship'

Add DV relationship 4 of type "The contact B" use DV 3 as the 'Relationship'


So now you should have connected person X to Org Y and then Org Y to person Z.


ANOTHER EXAMPLE might be if you want to show grandchildren where you have multiple parent-child relationships including some 2 level situations.

so Person A is Parent of Person B, and Person B is Parent of Person C

Hence Person A is 'grandparent' of Person C

  • In the paragraph beginning "Add relationship 3..." When you say "Add relationship 2 of type...", was that meant to read "Add relationship 4 of type...", rather than 2?
    – Lewis
    Commented Oct 5, 2016 at 0:20
  • When adding fields to a view like this, how do you distinguish between "person X" and "person Z"? How do you pick one or the other as they would appear to be in the 'same' relationship to Contact B?
    – Lewis
    Commented Oct 5, 2016 at 0:27
  • How would this arrangement change if I defined the relationships in CiviCRM differently? Say, person X is Contact B and Org Y is Contact A for that relationship, but person Z is Contact A and Org Y is Contact B for the second relationship? Will that simply not work in Views?
    – Lewis
    Commented Oct 5, 2016 at 0:35
  • 1
    I have edited above and added DV to clarify which are Drupal View relationships, v Civi relationships.
    – petednz - fuzion
    Commented Oct 5, 2016 at 7:39
  • Lewis. V hard to answer your very specific questions without seeing the details of your structure. But we have done very complex daisy chaining so would have to assume what you are wanting 'is' possible until proven otherwise
    – petednz - fuzion
    Commented Oct 5, 2016 at 7:43

This is an update to the answer given by petednz - fuzion. In my case I needed to create a view which showed a list of all employees of the organisation employing the currently logged in employee. In other words if a contact is logged into the website (Drupal), they can see the details for their organisation and all the employees of their organisation.

I followed the steps given in the answer by petednz, but this didn't work for me. I needed to adjust his section when connecting B to C to get it to work. The steps I followed were:

  1. Create user view
  2. Create relationship from user to CiviCRM contact (to create link from current Drupal user to their Civi contact details)
  3. Add Current User to filters (to only show information for logged in user)
  4. Create relationship for CiviCRM Relationship (starting from contact A)
  5. Create relationship: CiviCRM Relationships: Contact ID B (4 & 5 connects currently logged in user to organisation)
  6. Create relationship: CiviCRM Relationship (starting from Contact B)
  7. Create relationship: CiviCRM Relationships: Contact ID A (6 & 7 now shows all employees connected to the organisation shown in step 5)

To show fields relating to the currently logged in user use the relationship defined in step 2.

To show fields relating to the organisation, use the relationship defined in step 5.

To show fields relating to the employees of the organisation, use the relationship defined in step 7.

The difference between my answer and petednz's answer is that when he is connecting B to C, he creates the CiviCRM Relationship (starting from Contact A), and I use the CiviCRM Relationship (starting from Contact B), and then he creates the CiviCRM Relationships: Contact ID B, and I create the CiviCRM Relationships: Contact ID A.

I have created an export of my view which demonstrates the answer.

It should then be possible to create one part of the view to show the organisation details and then an attachment view to show the employees to tidy things up.

  • Thanks Ben, not sure if i tripped over my own logic at some point writing it up, or simply that the Relationship B-A and A-B is different in the two scenarios.. Providing an export is a really good idea. I try to do the same at our Treasure Trove: fuzion.co.nz/treasure-trove
    – petednz - fuzion
    Commented Oct 13, 2017 at 18:36
  • Thanks petednz for the link to your treasure trove, that is a very helpful resource!
    – Ben
    Commented Oct 14, 2017 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.