1

We're trying to create one table for phonebanking purposes that show the last two or three activities of one type associated with each row of contacts, putting that into a directory or search profile, and allowing users to edit the table through a Batch update or other means.

Columns:

  • First Name
  • Last Name
  • Phone
  • Email
  • Notes
  • Most recent activity (or Activity type 1)
  • Second most recent activity (of Activity type 1)
1
  • which bits of your table should be editable?
    – petednz - fuzion
    Commented Jun 25, 2015 at 1:27

2 Answers 2

1

pmoz has a good solution, but it's Drupal-only, and your View is going to be read-only, though perhaps you can get something approximating what you want with Views Bulk Operations.

Making a writable version of what you're decribing is going to be very difficult to implement, and will require custom coding. The reason for this is based in database theory and normalization. "Flattening" your data - multiple records on one line - goes against database design principles, and without getting into the math, the performance would be orders of magnitude slower than just grabbing the most recent activity.

If you can live with not being able to edit the activities, and you're not afraid of custom coding, here's a performant and relatively simple way of doing what you want:

  • Create custom fields on the contact - "Most Recent Activity" and "Second Most Recent Activity".
  • When an activity is created, use civicrm_hook_post to write the relevant values from the activity into your custom field.
  • If the "Most Recent Activity" field isn't empty, first copy its value into "Second Most Recent Activity".
  • Now you can use "Batch Update via Profile", using the custom fields rather than the activities themselves.

Finally - depending on what data you're trying to change, you may want to consider CiviSurvey instead of Batch Update via Profile.

1
  • Jon, Thanks for the advice. I suspected as such. It's hard for us to move away from a flat spreadsheet (unwieldy as it may have been) to a database that uses tabs, types, and categories for individual contacts. Looks like I've got some custom coding to learn!
    – Tim
    Commented Jun 24, 2015 at 23:45
1

We accomplish basically the same thing using Views and a profile.

Create a profile with the fields you want people to be able to edit.

Create a View of CiviCRM Activities, add a relationship of Activity Contact ID, select the contact you want to list (source, target, assignee).

Add Display Name, Phone, email, Activity Date and a custom text field (name it edit and link to your profile) fields.

Sort first by sort name, then by activity date.

Filter by activity type.

Add an exposed filter for Display Name contains.

That should almost get you there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.