Answers.Body: <p>Okay.  Answering my own question here.  Not sure what the etiquette is, but felt like it just needed to be closed off.</p>
  
  <p>I asked two questions above and I think now the answers are:</p>
  
  <ol>
  <li><p>I don't know, but the odds seem stacked against this way of solving my problem.</p></li>
  <li><p>Yes, there is a better way.  Use CiviCRM relationships.  In my case, I created a relationship called 'Campus contact' that I could use to extract the data I wanted within the View.  That meant the View was dealing with two relationships, Members -> Organisation and Campus contact -> Organisation.</p></li>
  </ol>
  
  <p>My inspiration came from petednz, in his post, referenced in my comment below (?), on daisy chains of relationships in views.</p>
  
  <p>His post was specific to A->B->C arrangements, which wasn't precisely my problem.  My arrangement is A->C and B->C.</p>
  
  <p>Because of that difference, because petednz was giving a bare bones outline of the idea rather than a detailed account of the background and logic of it, and because my question title here won't be found by people trying to figure out relationship chains in views, I intend to ask and answer a separate question about my situation, so as to provide a resource for others more generally.</p>
  
  <p>Will edit to include link in due course.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-06T05:11:48.480Z
Answers.LastActivityDate: 2016-10-06T05:11:48.480Z
Answers.UserDisplayName: Lewis
Answers.Body: <p>There may be a reason you want this as a 'drupal contact me' link but if you have the contact ID for the person you are wanting to be contactable in your View, then you should be able to provide a link to a webform with that cid1=x and therefore load that persons details in to the webform and use that as your 'contact me' option.</p>
  
  <p>But to try and answer the other question, I would expect you to be able to add a 'drupal user' relationship to your existing relationships in the view, and set it to use the existing relationship that relates to the contact person</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-04T21:08:01.557Z
Answers.Text: Thanks for that. I can see that your webform solution would work.  I was wanting to preserve the system we had been using, which is using the Drupal contact form.
Answers.UserDisplayName: Lewis
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-04T21:36:07.090Z
Answers.Text: The problem I'm facing is that the contact person is not in a Civi relationship with the organisation.  It is a custom contact reference field of the organisation.
  
  Perhaps my real question is how do I access the full data record of the Civi contact in the contact reference field?
  
  Will edit OP to reflect the more precise question.
Answers.UserDisplayName: Lewis
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-04T21:57:22.067Z
Answers.Text: To be specific, I know how to add a drupal user relationship to the view, what I can't seem to figure out is how to force it to relate to the contact person, when I already have two other CiviCRM contacts in play, the organisation and the members of the organisation.  How do I set that drupal user relationship to relate to the third CiviCRM contact, the contact reference field?
Answers.UserDisplayName: Lewis
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-04T22:01:59.300Z
Answers.Text: ah got you - i think i should remove this answer then since "The way I have structured the data is to have the institution contact person be a custom contact reference field" wasn't something i really absorbed - and have to say 'i do not know'. sorry.
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-04T22:09:25.273Z
Answers.Text: Terrible news. I was counting on you! Thanks for trying. Yes. I'm now realising that to make the webform solution work I still need to pull the data from the contact in the contact reference field, which seems to be the more fundamental issue for me.
Answers.UserDisplayName: Lewis
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-04T22:48:53.163Z
Answers.Text: Hang on! Your answer here (http://civicrm.stackexchange.com/questions/739/how-to-create-a-drupal-view-with-multiple-civicrm-relationships) suggests that daisy-chaining relationships should work, which means that if I go for my 'solution' 2 and use a relationship to define the contact person for an organisation, instead of a contact reference field, the whole thing ought to be possible.
Answers.UserDisplayName: Lewis
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-05T08:07:11.833Z
Answers.Text: Yes i would be aiming to do this all via Relationships - that way you get to daisy chain AND you get option to use Permissioned Relationships as an easy to manage ACL if you need
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-04T07:45:59.957Z
Answers.LastActivityDate: 2016-10-04T07:45:59.957Z
Answers.UserDisplayName: petednz - fuzion
Body: <p>I have an organisation with members across many institutions around Australia and each institution will have one of those members as a contact for that institution.</p>
  
  <p>On each institution's landing page on my site, I want to display a 'contact me' link for the designated contact person for that institution.</p>
  
  <p>The data for both the institution and individual are held in CiviCRM, although the individual contacts are users in Drupal as well.</p>
  
  <p>The way I have structured the data is to have the institution contact person be a custom contact reference field in CiviCRM that is attached to the Organisation contact type.</p>
  
  <p>On my institution landing pages, created with a Drupal view, I can display the organisation data from Civi, including the institution contact person, and, using a CiviCRM relationship (B to A), list the members who are at that institution.</p>
  
  <p>However, what I cannot figure out is how to link the institution contact person to their Drupal ID, so as to be able to rewrite the output of that field and link their name to a Drupal contact form.</p>
  
  <p>I can link the list of members to Drupal ID's because they are Contact A of the CiviCRM relationship, but the institution contact person (who is also in the list of members, of course) is a field of Contact B, which does not have a Drupal ID.</p>
  
  <p>[EDIT] A more concise way to describe the problem.  I have a view based on the relationship between an organisation and its members.  One field of the organisation is a contact reference.</p>
  
  <p>I want to:</p>
  
  <ol>
  <li><p>Display fields from the organisation</p></li>
  <li><p>Display a list of members of the organisation</p></li>
  <li><p>Link the contact reference field of the organisation to its Drupal user</p></li>
  </ol>
  
  <p>I have managed 1. and 2.</p>
  
  <p>I presume that the question related to 3. above is how do I access the full contact record (including Drupal ID) of the contact in the contact reference field when the view is based on a different CiviCRM contact, namely the organisation?[\EDIT]</p>
  
  <p>Questions:</p>
  
  <ol>
  <li><p>Is there a way to solve Point 3 above with relationships and filters in views the way I have the data structured, and, if so, how?</p></li>
  <li><p>Is there a better way to structure the data, and, if so, how?  For example, would it be better to create a CiviCRM relationship to define the contact person, e.g. "Contact person for"/"Our contact person", and then try to set up multiple relationships with the institution in Views to get the links right?</p></li>
  </ol>
  
  <p>If 2, then some advice as to how to proceed with relationships would also be appreciated.</p>
  
  <p>Thanks,
  Lewis</p>
  
Tags: <drupal-views><relationships>
Title: How to create a drupal 'contact me' link where the user is a contact reference field of Contact B in a civi relationship
ThreadText: # How to create a drupal 'contact me' link where the user is a contact reference field of Contact B in a civi relationship
  
  (Asked by: username_0 on 2016-10-04)
  
  I have an organisation with members across many institutions around Australia and each institution will have one of those members as a contact for that institution.
  
  On each institution's landing page on my site, I want to display a 'contact me' link for the designated contact person for that institution.
  
  The data for both the institution and individual are held in CiviCRM, although the individual contacts are users in Drupal as well.
  
  The way I have structured the data is to have the institution contact person be a custom contact reference field in CiviCRM that is attached to the Organisation contact type.
  
  On my institution landing pages, created with a Drupal view, I can display the organisation data from Civi, including the institution contact person, and, using a CiviCRM relationship (B to A), list the members who are at that institution.
  
  However, what I cannot figure out is how to link the institution contact person to their Drupal ID, so as to be able to rewrite the output of that field and link their name to a Drupal contact form.
  
  I can link the list of members to Drupal ID's because they are Contact A of the CiviCRM relationship, but the institution contact person (who is also in the list of members, of course) is a field of Contact B, which does not have a Drupal ID.
  
  [EDIT] A more concise way to describe the problem. I have a view based on the relationship between an organisation and its members. One field of the organisation is a contact reference.
  
  I want to:
  
  1. Display fields from the organisation
  2. Display a list of members of the organisation
  3. Link the contact reference field of the organisation to its Drupal user
  
  I have managed 1. and 2.
  
  I presume that the question related to 3. above is how do I access the full contact record (including Drupal ID) of the contact in the contact reference field when the view is based on a different CiviCRM contact, namely the organisation?[\EDIT]
  
  Questions:
  
  1. Is there a way to solve Point 3 above with relationships and filters in views the way I have the data structured, and, if so, how?
  2. Is there a better way to structure the data, and, if so, how? For example, would it be better to create a CiviCRM relationship to define the contact person, e.g. "Contact person for"/"Our contact person", and then try to set up multiple relationships with the institution in Views to get the links right?
  
  If 2, then some advice as to how to proceed with relationships would also be appreciated.
  
  Thanks,
  username_0
  
  **Tags:** drupal-views, relationships
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2016-10-06. Score: 1 | Accepted answer
  
  Okay. Answering my own question here. Not sure what the etiquette is, but felt like it just needed to be closed off.
  
  I asked two questions above and I think now the answers are:
  
  1. I don't know, but the odds seem stacked against this way of solving my problem.
  2. Yes, there is a better way. Use CiviCRM relationships. In my case, I created a relationship called 'Campus contact' that I could use to extract the data I wanted within the View. That meant the View was dealing with two relationships, Members -> Organisation and Campus contact -> Organisation.
  
  My inspiration came from petednz, in his post, referenced in my comment below (?), on daisy chains of relationships in views.
  
  His post was specific to A->B->C arrangements, which wasn't precisely my problem. My arrangement is A->C and B->C.
  
  Because of that difference, because petednz was giving a bare bones outline of the idea rather than a detailed account of the background and logic of it, and because my question title here won't be found by people trying to figure out relationship chains in views, I intend to ask and answer a separate question about my situation, so as to provide a resource for others more generally.
  
  Will edit to include link in due course.
  
  
  ---
  
  ### Answer by username_1 on 2016-10-04. Score: 1
  
  There may be a reason you want this as a 'drupal contact me' link but if you have the contact ID for the person you are wanting to be contactable in your View, then you should be able to provide a link to a webform with that cid1=x and therefore load that persons details in to the webform and use that as your 'contact me' option.
  
  But to try and answer the other question, I would expect you to be able to add a 'drupal user' relationship to your existing relationships in the view, and set it to use the existing relationship that relates to the contact person
  
  > **Comments:**
  > **username_0**: Thanks for that. I can see that your webform solution would work.  I was wanting to preserve the system we had been using, which is using the Drupal contact form.  
  > **username_0**: The problem I'm facing is that the contact person is not in a Civi relationship with the organisation.  It is a custom contact reference field of the organisation.  Perhaps my real question is how do I access the full data record of the Civi contact in the contact reference field?  Will edit OP to reflect the more precise question.  
  > **username_0**: To be specific, I know how to add a drupal user relationship to the view, what I can't seem to figure out is how to force it to relate to the contact person, when I already have two other CiviCRM contacts in play, the organisation and the members of the organisation.  How do I set that drupal user relationship to relate to the third CiviCRM contact, the contact reference field?  
  > **username_1**: ah got you - i think i should remove this answer then since "The way I have structured the data is to have the institution contact person be a custom contact reference field" wasn't something i really absorbed - and have to say 'i do not know'. sorry.  
  > **username_0**: Terrible news. I was counting on you! Thanks for trying. Yes. I'm now realising that to make the webform solution work I still need to pull the data from the contact in the contact reference field, which seems to be the more fundamental issue for me.  
  > **username_0**: Hang on! Your answer here (http://civicrm.stackexchange.com/questions/739/how-to-create-a-drupal-view-with-multiple-civicrm-relationships) suggests that daisy-chaining relationships should work, which means that if I go for my 'solution' 2 and use a relationship to define the contact person for an organisation, instead of a contact reference field, the whole thing ought to be possible.  
  > **username_1**: Yes i would be aiming to do this all via Relationships - that way you get to daisy chain AND you get option to use Permissioned Relationships as an easy to manage ACL if you need  
  
  ---
  
  