4

On Drupal 7, how would you display a list of CiviCRM activities and show the two types of contacts (the activity related to the client and the user who created the activity)?

Views is pretty tricky here. All the primary fields (Activity ID, Status, Type, Activity Date, Text Link) can be added without any problems. Each row in the table represents a unique activity entry. When it came to adding the names of the individuals for the client and person who created the activity, I'm having difficulty with it. I tried adding a relationship to "CiviCRM Activity Contacts: Activity Contact ID"; however, this will duplicate some of the activities in the data.

  • Activity Assignees: Will not display the person who created the activity
  • Activity Source: Displays the person who created the activity, but unclear how I would add the target contact (the client). Contact A/B doesn't work well.
  • Activity Targets: Display the target contact (the client). Added a relationship successfully to display the user (person who created the activity), but one activity now appears in 9 rows.

The only way I can think of displaying a list of unique activities is possibly aggregating (Views "use aggregation"? Table with aggregation options module to group Activity IDs?). Am I thinking about this too much?

6

No aggregation necessary.

Under relationships add two relationships for activity contacts. Select one to be the source and the other to be the target.

Once you've got those relationships, you can add two display name fields. One tied to the source relationship and one tied to the target relationship.

Under filters add activity is deleted false, activity is current revision true.

In the fields section, in the activity ID settings select filter repeats.

  • Thanks, Paul! I'm stuck on the last step, I don't see filter repeats in the Activity ID settings. – Kristine Nov 11 '15 at 4:52
  • Actually I believe you need the Views Distinct module to filter on repeats. Good module that I take for granted. – pmoz Nov 11 '15 at 10:13
  • Thanks, Paul! That worked perfectly. One thing to note for other users: You must have the pager as "Full" and display all items. If you don't, there will still be duplicates. – Kristine Nov 18 '15 at 4:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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