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 are contacts & activities related at the table level?
Pages: [1]

Author Topic: How are contacts & activities related at the table level?  (Read 974 times)

clarkac

  • Administrator
  • Ask me questions
  • *****
  • Posts: 399
  • Karma: 11
  • CiviCRM version: 4.4.11 & 4.5.5
  • CMS version: Drupal 7
  • MySQL version: 5.1.61-cll
  • PHP version: 5.3.27
How are contacts & activities related at the table level?
May 10, 2013, 09:03:20 am
I'm trying to work out how the civicrm_contact table is related to the civicrm_activity table.  It should be obvious, so probably this is a dumb question.  I see 'id' in the contact table which has, for example, a value of 614 - a contact I added.  The activity table also has an activity for this new contact, but the id field has a value of 288.  I see no other foreign keys or other tables that might be in the relationship.  But Civi correctly displays activities for the right contacts so some magic is going on, I just don't know where  >:(   Can anyone explain how this works?  Please?
Andy Clark

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: How are contacts & activities related at the table level?
May 10, 2013, 11:23:09 am
I think this is changing in 4.4. but for now, have a look at

source_contact_id in the civicrm_activity table and the following two tables:
* civicrm_activity_target
* civicrm_activity_assignment
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

clarkac

  • Administrator
  • Ask me questions
  • *****
  • Posts: 399
  • Karma: 11
  • CiviCRM version: 4.4.11 & 4.5.5
  • CMS version: Drupal 7
  • MySQL version: 5.1.61-cll
  • PHP version: 5.3.27
Re: How are contacts & activities related at the table level?
May 10, 2013, 01:36:35 pm
Thanks, Michael, I missed seeing the target_contact_id in the civicrm_activity_target table.  Now I understand!
Andy Clark

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • How are contacts & activities related at the table level?

This forum was archived on 2017-11-26.