Building a View with Contacts and Activities

Last updated on
23 July 2018

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

CRM Core provides detailed integration with the views module. All of the entities contained in CRM Core can be used together in views to provide detailed tools for interacting with contact information.

A common use case for CRM Core is the need to display a list of recent activities, along with some information about the participants. You might need a list that displays the title of the activity along with the name of the contact who participated.

CRM Core supports this kind of view through the use of relationships. The way to create a view that follows this pattern is simple:

  1. Create a new view. Give it a title and a description. Under the show menu, select CRM Core Activities. Press the continue and edit button.
  2. On the resulting screen, add a relationship. Select the entity reference: participants option. This will give you access to the fields for the associated contacts.
  3. Add fields for the contact record.

At this point, you will have a view that displays information about a contact. In order to add activity information, you need to create a relationship between the contact and the activity. This is easily accomplished through the Views edit screen, by way of the relationships menu.

  1. Click the Advanced roll out on the Views edit screen.
  2. Under the Relationships heading, click 'Add.'
  3. Filter by entity reference.
  4. Check the box for the item labelled 'Entity Reference: referencing entity.' It should have descriptive text that says 'A bridge to the CRM Contact entity that is referenced via field_activity_participants.'
  5. On the resulting screen, click save. Within views, you will now have access to fields for the activity records, and they will be linked to the contacts being presented in each row of results.

An example view is provided with this documentation, demonstrating a very basic activity to contact relationship.

Help improve this page

Page status: No known problems

You can: