1

We have been working on Views, with Civi Entity, on Drupal 8.

We are having an issue a list of Activities and filters. We only want to load Activities where the source contact is a particular Contextual filter (contact ID). But adding a Contextual Filter of 'CiviCRM Activity (CiviCRM Entity): Activity Source Contact' leads to an error.

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'civicrm_activity.source_contact_id' in 'where clause': SELECT civicrm_activity.id AS id FROM {civicrm_activity} civicrm_activity LEFT JOIN {civicrm_value_volunteering__9} civicrm_value_volunteering__9 ON civicrm_activity.id = civicrm_value_volunteering__9.entity_id WHERE (((civicrm_activity.activity_type_id = :civicrm_activity_activity_type_id)) AND ((civicrm_activity.source_contact_id = :civicrm_activity_source_contact_id))) AND ((civicrm_activity.is_deleted = :db_condition_placeholder_0) AND (civicrm_value_volunteering__9.validated__200 = :db_condition_placeholder_1)) LIMIT 11 OFFSET 0; Array ( [:civicrm_activity_activity_type_id] => 66 [:civicrm_activity_source_contact_id] => 20 [:db_condition_placeholder_0] => 0 [:db_condition_placeholder_1] => 1 )

Is that the right method for adding a contextual filter to that type of View. Or is there another way?

Olly

2 Answers 2

2

Here's a working example of "My Activities" Olly: you should just be able to change Assignee to Source for your use case (in Configure Relationship Contact)

Code: git repo -> last commit ->

commit bb1f503bd67d1537a16b28022a4f2444883ef231
Author: Rob Ellis <>
Date:   Sun Oct 11 23:21:17 2020 +0000

    Changed views contact subtype default arg to return "<none>" for users without a subtype

enter image description here

enter image description here

enter image description here

enter image description here

1

This is a known issue which is locked in github repo. There is a work in progress to fix the issue.

You can try applying the below patch in your d8 install to see if it resolves your problem

2
  • I'm having the same problem. I tried applying the two patches and this didn't help in my case. I'm using the 8.x-3.x branch directly from the github repo. Do you have any suggestions?
    – Ben
    Commented Sep 24, 2020 at 14:14
  • I have this working on a site - will find/extract/post the yaml once I have some espresso. Commented Dec 11, 2020 at 13:36

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