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:
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