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) »
  • Activities, custom fields, and hooks
Pages: [1]

Author Topic: Activities, custom fields, and hooks  (Read 1128 times)

outinsun

  • Guest
Activities, custom fields, and hooks
February 19, 2010, 01:40:15 pm
I need to track certain things my users to do contact records. For example, someone might mark a contact as "banned". Would need to track who marked them banned, when, and why.

A custom field called "banned" works fine for the marking. Can filter contacts in searches by whether or not they are banned.

Activities are perfect for tracking the banning action. Can have custom activity types for "ban" and "rehabilitate", with a custom field containing possible reasons for the banning.

Question: how do I link the two together, so users don't have to a) mark the contact banned, then b) remember to manually create the appropriate activity record. Is there a civicrm hook that I could use to, for example, automatically set "banned" when a "ban" activity is created, and clear "banned" when a "rehabilitate" activity is created?

outinsun

  • Guest
Re: Activities, custom fields, and hooks
February 19, 2010, 01:57:33 pm
Oh and while I'm at it, I'd also like to link custom fields and activities in the opposite direction. When a user updates a field in a given Custom Group, I'd like to drop an activity in the system that tracks what custom group they updated.

I know there is an ongoing discussion about extending change logs. They might fit the bill here. I am looking at activities as a general mechanism for tracking things that get done to contacts. Ability to customize activity types and custom fields, and to search/report on them, is a great thing.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Activities, custom fields, and hooks
February 19, 2010, 02:08:46 pm

check:

http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+hook+specification

in specific check the:

post hook: http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+hook+specification#CiviCRMhookspecification-hookcivicrmpost

which u can use on contact and activity

and the custom hook, for custom fields:

http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+hook+specification#CiviCRMhookspecification-hookcivicrmcustom

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

outinsun

  • Guest
Re: Activities, custom fields, and hooks
February 19, 2010, 02:15:03 pm
Sweet. Is it possible to set these hooks only to run in certain situations (activity type = "ban", custom field's custom group = "xyz"), or do I need to code that in myself (if activity type != "ban" then exit)?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Activities, custom fields, and hooks
February 19, 2010, 07:41:04 pm

u need to code in the conditional yourself, unless you start pushing the rules integration forward

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Activities, custom fields, and hooks

This forum was archived on 2017-11-26.