CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • how to identify individual contacts and their related assistants
Pages: [1]

Author Topic: how to identify individual contacts and their related assistants  (Read 836 times)

daveatkins

  • I post occasionally
  • **
  • Posts: 68
  • Karma: 2
  • CiviCRM version: 4.1.6
  • CMS version: Drupal 6.28
  • MySQL version: 5.1.41
  • PHP version: 5.2.10
how to identify individual contacts and their related assistants
May 21, 2012, 09:25:57 am
Ultimately, I want a smart group here, but I cannot figure out how to approach this.

I have contacts who are board members and therefore members of a group "board members"

they have assistants who are not members of that group, but have a relationship of "assistant to" the board members.

How do I do a search that returns the board members and their assistants? Or even just the assistants--I could AND that group with the "Board Members" group to get the complete mailing list.

If I search for people with the relationship "assistant to" then it returns everyone with such a relationship; not limited to current board members, so that is no good.

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: how to identify individual contacts and their related assistants
May 21, 2012, 11:08:30 pm
Is it an idea to create two smart groups, one for the board members (members of the group) and one for all active relations 'assistant to'? Then you can play with the 2 groups in mailings and searches?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

daveatkins

  • I post occasionally
  • **
  • Posts: 68
  • Karma: 2
  • CiviCRM version: 4.1.6
  • CMS version: Drupal 6.28
  • MySQL version: 5.1.41
  • PHP version: 5.2.10
Re: how to identify individual contacts and their related assistants
May 22, 2012, 02:10:24 pm
I'm not following. I already have a group for the board members, so I do not need a smart group there. I have tried creating a smart group of all assistants, but how do I make them limited to the board members?

In SQL, this is relatively easy (relationship_type_id 13 is "has assistant")

Code: [Select]
/* identify board members and their assistants */

select cc.display_name, cc.organization_name, crt.name_a_b, cc2.display_name
from civicrm_contact cc
join civicrm_relationship cr on cr.contact_id_a=cc.id
join civicrm_contact cc2 on cr.contact_id_b = cc2.id
join civicrm_relationship_type crt on cr.relationship_type_id = crt.id
join civicrm_group_contact cgc on cgc.contact_id=cc.id
join civicrm_group cg on cgc.group_id=cg.id
where cr.relationship_type_id = 13
and cg.name = 'Board of Directors (P)';

But then I need to pull together all the email addresses and mailing addresses etc. which would be easier to obtain if this set were defined as a group in Civi vs me hand-coding a report for what should be a very common sort of need of users, I would think.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • how to identify individual contacts and their related assistants

This forum was archived on 2017-11-26.