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 Profiles (Moderator: Dave Greenberg) »
  • Create relationship between new contact & existing contact in profile creation
Pages: [1]

Author Topic: Create relationship between new contact & existing contact in profile creation  (Read 1129 times)

HeidiP

  • I’m new here
  • *
  • Posts: 7
  • Karma: 1
Create relationship between new contact & existing contact in profile creation
November 17, 2010, 05:59:14 pm
Hi Guys,

I'm using CiviCRM 3.2 and Drupal 6.17, and I'm relatively new to CiviCRM.

I have set up profiles for three types of CiviCRM contacts, and that's working well.
The contacts are 'user', 'division' and 'team'.
There are several 'users' in a 'team', and several 'teams' in a 'division'.

Within a 'user' profile creation, I would like to add a drop down box (or something similar) that allows the selection of a 'team'.
Upon the 'user' creation, I would like this to assign the 'user' a relationship of 'is a member of' and the 'team' a relationship of 'has a member called'.
Ideally, this would also flow through to the 'division', so that it also has a relationship to the 'user, through the 'team'.

I would also like to do something similar for the creation of a 'team' and a relationship to a 'division'.

Is this possible?
Does anyone have any idea of how I could go about setting this up?

Cheers,
Heidi

Rajan Mayekar

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 20
    • Rajan's Blogs
Re: Create relationship between new contact & existing contact in profile creation
November 17, 2010, 10:08:08 pm
I think you can do this by two ways
first and I think more in drupal way is
 - use cck, content_profile and CiviCRM CCK Contact Reference module
 - add CiviCRM contact reference field ( which will list team ) on user registration
 - implement hook_submit ( or may be hook_user ), to add relationship in CiviCRM using CiviCRM api , http://wiki.civicrm.org/confluence/display/CRMDOC32/Relationship+APIs .

And second way is to use only CiviCRM Hooks and api
hook_civicrm_buildForm ( to add select field for team) and hook_civicrm_postProcess ( to implement your logic after form submit  )

Hope this will help you..

Rajan

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: Create relationship between new contact & existing contact in profile creation
November 17, 2010, 11:55:52 pm
If you want more information on the API's and hooks, check the book:
http://en.flossmanuals.net/CiviCRM/DevelopIntro
Erik
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Create relationship between new contact & existing contact in profile creation
November 18, 2010, 01:39:21 am
Install from the svn (just to get the code)

This drupal module allows to register at the same time an individual and an organisation.
tools/drupal/modules/civicrm_regsite/

Might give you ideas and directions, but you definitely have to read the book, that's using hooks and other stuff everywhere ;)

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

HeidiP

  • I’m new here
  • *
  • Posts: 7
  • Karma: 1
Re: Create relationship between new contact & existing contact in profile creation
November 21, 2010, 04:26:57 pm
Brilliant :)
Thanks guys, I've got plenty to work with now :)
Cheers,
Heidi

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Create relationship between new contact & existing contact in profile creation

This forum was archived on 2017-11-26.