CRM-9212 No recipients when mailing to a smart group based on a 'related contacts' search

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.2.5, 3.3.6, 3.4.alpha, 3.4.beta, 3.4.0, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 3.4.5, 3.4.6, 3.4.7, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.0.4, 4.0.5, 4.0.6, 4.0.7
    • Fix Version/s: 4.1.0
    • Component/s: CiviMail, Core CiviCRM
    • Labels:
      None

      Description

      if you use a 'related contacts' search to form a smart group, this smart group shows 0 recipients when used in Civimail. Example - I used 'related contacts' to identify the parents of children in a particular group; when added to a smart group it showed 16 contacts; when used in Civimail it showed 0 recipients. Lobo said that as this is a new feature it seems to be a bug. I reproduced the same problem on the demo site. I currently use 4.0.7 with Drupal 7

        Attachments

          Activity

          [CRM-9212] No recipients when mailing to a smart group based on a 'related contacts' search
          Donald A. Lobo added a comment -

          Lindsey:

          I could not replicate this on 4.1 version, Can you try it here: http://sandbox.drupal.civicrm.org/

          note that the demo data is quite awful (IMO). Lots of deceased folks, opt out folks, do not email folks and no email addresses. Might wnat to create a small set of contacts to try this experiment on

          Lindsey Mansfield added a comment -

          Hi lobo. I have created 2 families. Johnnie Smith and Abby Black are in a group called Children's group. Their parents are Bob & Elena Smith and Jack & Jane Black. The first problem I hit is that in the demo when I choose in Advanced Search to 'Display Results As' Related Contacts I don't then get the dropdown that I get in my Civi to choose relationship type eg Parent of. This means that I can't test any further.

          When I first tried testing on the demo I also hit this so just used 'related contacts' with no relationship specified to test. That was what gave me the example I quoted above. Is it possible to have the Related Contacts dropdown on the demo so I can test this issue fully?

          Lindsey Mansfield added a comment -

          Aargh - too early in the morning - I've just seen your sandbox suggestion. Will get onto that now!

          Lindsey Mansfield added a comment -

          lobo - I'm no further forward I'm afraid. I went onto the Sandbox and created Abby Black, put her in a group called Sunday School and also created her parents John & Jean Black. I then went to Adv Search and searched for Related Contacts (parent of) Sunday School group. It gave me no results and said: No matches found for:
          Contacts IN Sunday School AND Group Status - "Added" ...AND...
          Contacts with a Relationship Type of: 'Parent of'

          When I do this search in our 4.0.7 Civi using Drupal 7 (parents of a group populated by children) it works! Any ideas... as this means I still can't test and replicate the issue in question in the Sandbox. I've just tried again to replicate the issue on the main demo site using the same scenario (though using just related contacts as I couldn't specify parents of). It also gave me: No Contacts IN Sunday School AND Group Status - "Added" which is not what I was searching for anyway.

          Jamie McClelland added a comment -

          I'm not sure how to exactly replicate this issue.

          But I have found a way to replicate the problem of CiviCRM showing different contact lists for smart groups using "Display Results as" that might help.

          I created a smart group called "employees of orgs" which should display contacts that are employees of organizations (there are 11 organizations in the database and only one contact that is an employee of one of these organizations).

          You can see it here:

          http://sandbox.drupal.civicrm.org/civicrm/group/search?reset=1&force=1&context=smog&gid=6

          (Or click "Contacts" from the Manage Groups page for this group.)

          It lists 11 organizations. This is incorrect because the smart group should be displaying related employees, not the organizations.

          If you click "Edit Smart Group Search Criteria for employees of orgs" it will only display 1 contact (this is the expected result).

          It seems that CiviCRM is not consistently respecting the instruction to display related results as opposed to displaying the direct results.

          I tried using the smart group in a mailing, and CiviCRM reported 5 contacts would receive the mailing. There are exactly 5 organizations with email addresses. So, CiviMail seems to be using the right smart group criteria, but ignoring the display related contacts instruction.

          Here are the steps I took to create the "employees of orgs" smart group:

          • Picked random organization contact and added random Employee of contact
          • Click Search -> Advanced Search
          • Select Contact Type -> Organization
          • Select Display Results As "Related Contacts" -> "Employee Of"
          • Click Search
          • Shows two individual contacts (as expected)
          • Select "All 1 Records"
          • Select "New Smart Group"
          • Provide name and save smart group

          Also... CRM-7948 and CRM-8386 seem related.

          Lindsey Mansfield added a comment -

          I've replicated the exactly same issue as Jamie on the sandbox:

          • Helen Black and Dave White are children in the Related Contacts Test Group - Children. They have 2 parents each.
          • I searched for related contacts (parents) of the above group members and put them in Related Contacts Smart group - Parents
          • The smart group incorrectly shows 2 contacts (Helen and Dave, not their parents) but when you Edit Smart Group Criteria it correctly shows the 4 parents. When you use the smart group in Civimail it shows 2 contacts.

          The odd thing is that in our system (Civi 4.0.7), the initial pattern is the same as above (smart group doesn't respect the 'related contacts' search results, but related contacts show when you edit smart group criteria)... however, when I then use the smart group in Civimail it shows 0 contacts (ie at this point it doesn't even show the children).

          Lobo - is there anything further we can do on this as far as testing goes, or are you ok to arrange a fix for 4.2 given the info here?

          Many thanks. Lindsey

          Jamie McClelland added a comment -

          Hi Lindsey - Do the children have email addresses in your database?

          My guess is that Civimail shows 0 because it is (incorrectly) looking for the children, and eliminating children that don't have email addresses.

          Just a guess...

          jamie

          Lindsey Mansfield added a comment -

          Jamie - you're right I suspect! I hadn't thought of that.

          Lobo - wonderful to see the fix has been brought forward to 4.1 Thank you!

          Donald A. Lobo added a comment -


          There is a patch committed against this. jamie if you can test it that would be great

          Jamie McClelland added a comment -

          Thanks lobo!

          I checked out the v4.1 branch from subversion and could not replicate the error, so I think this is fixed.

          jamie

            People

            • Assignee:
              Donald A. Lobo
              Reporter:
              Lindsey Mansfield

              Dates

              • Created:
                Updated:
                Resolved: