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 add a relationship to multiple contacts - Missing function? Blind newbie?
Pages: [1]

Author Topic: How to add a relationship to multiple contacts - Missing function? Blind newbie?  (Read 786 times)

supporters

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
How to add a relationship to multiple contacts - Missing function? Blind newbie?
January 02, 2011, 06:17:40 am
I read documentation somewhere (I've lost the link at the moment but its way back in my search history) that said we could update relationships via an action on the search results page (currently running CiviCRM 3.3) but I'm not finding it.  I tried creating a profile, but couldn't find where or figure out how to get the relationship field to be included.  I tried on the Drupal Demo CiviCRM site but also could not find such a way.  I've searched / read through forums and the updates pages but I'm not having much luck.  I'm fairly certain this isn't a super unique function but most likely it has already been addressed and I'm just not finding it.  

If the solution can't be done through the GUI right now, if someone could post the SQL instruction at little effort, our nonprofit would be super-grateful.
...
Via the options menu, we added a custom organization subtype: GC Project  (i.e. grant/contract project)
Via the contact add form, we added an organization: 'XYZ Foundation'
Via the contact add form, we've added a bunch of contacts of the 'GC Project' custom org subtype (with a common prefix,'[GCPREFIX]')
Via the options menu, we added a custom relationship type: A=Funds, B=Funded By
We want to add the relationship 'Funded By' to the selected contacts of the 'GC Project' custom org subtype for the selected contact 'XYZFoundation'
...
Here's a start for retrieving the list of contact id's we want to add the relationship TO:

  SELECT civicrm_contact.id, civicrm_contact.organization_name
  FROM ourdbname_civicrm.civicrm_contact
  WHERE civicrm_contact.contact_sub_type='GC_Project' AND civicrm_contact.organization_name LIKE 'GCPREFIX%'

then we'll want something like:

  INSERT INTO ourdbname_civicrm.civicrm_relationship  (contact_id_a,contact_id_b,relationship_type_id,is_active,is_permission_a_b,is_permission_b_a)
  VALUES ('16',[civicrm_contact.id='[variable of id from above query]'],'21','1','0','0')

where in our case 16 is the id of the record with the desired contact_id_a (XYZ Foundation)
and
where in our case 21 is the id of the record with the desired relationship_type (Contact A 'FUNDS' Contact B)
« Last Edit: January 02, 2011, 08:32:27 am by supporters »

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: How to add a relationship to multiple contacts - Missing function? Blind newbie?
January 02, 2011, 10:21:47 pm
Quote
If the solution can't be done through the GUI right now,

You can add relationship to multiple contacts.
Go to Contact A and click Actions and Add Relationship and then you say Find Target Contact and specify the  substring and Search it gives you bunch of contacts which you can Mark Target Contact(s) for this Relationship by checking the contacts and save Relationship. This would create the relationship between the selected/checked contacts with contact A.

HTH
-Yashodha
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

supporters

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
Re: How to add a relationship to multiple contacts - Missing function? Blind newbie?
January 05, 2011, 03:15:40 am
This is very exciting -- unfortunately, I came to realize much of the problem was with the IE browser we're using, since it doesn't display anything but a thin black line (the background of its menu system) with content hidden behind the other windows/panes/whatever, with the ribbon "Summary...Contributions...Pledges...Memberships...etc." blocking the action menu items; momentarily I temporarily see sections of the menu with some items but it quickly becomes inaccessible.  Looks like a CSS issue of some kind I'll have to address next.  When I tried it out in Firefox browser, it appears just fine.  I see what you mean!  I still don't think I would have figured it out right away to use a search string in the textbox because I tried to multi-select the entries that would popup, rather than proceed with search.  Hopefully this can be documented for users in the appropriate sections (e.g. relationship function(ality)/feature, maybe elsewhere). 

Appreciate the input!
« Last Edit: January 05, 2011, 03:29:29 am by supporters »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • How to add a relationship to multiple contacts - Missing function? Blind newbie?

This forum was archived on 2017-11-26.