1

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, Lewis

2 Answers 2

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

7
  • 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.
    – Lewis
    Commented Oct 4, 2016 at 21:08
  • 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.
    – Lewis
    Commented Oct 4, 2016 at 21:36
  • 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?
    – Lewis
    Commented Oct 4, 2016 at 21:57
  • 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.
    – petednz - fuzion
    Commented Oct 4, 2016 at 22:01
  • 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
    – petednz - fuzion
    Commented Oct 5, 2016 at 8:07
1

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.

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.