Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-21459

Disabling/deleting a custom field silently affects smart groups that use it

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 4.7.27
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding
    • Verified?:
      No

      Description

      Background/issue:

      We have a lot of groups. A few of these are smart groups, based off of custom data values.

      We recently tidied out (disabled) some old custom data fields, without realizing that smart groups were based on them.

      Disabling or deleting a custom field 'silently' affects the saved search criteria; effectively removing the 'where' clause from the smart group. So our smart group of 12 people became a smart group of everyone in our database.

      We caught this when the group was added to a mailing (thankfully before the mailing was sent).

      It would be good if CiviCRM was more 'forgiving' here - providing a little more information about the consequences of disabling/deleting a particular custom field.

      Proposed solution:

      When disabling or deleting a custom field; in the confirmation dialog:

      • List the profiles where that custom field appears
      • List the saved searches (smart groups) which use that custom field

      Steps to recreate (dmaster):

      • Create a custom text field 'foo' on individuals (searchable)
      • Create a contact Mr X
      • On Mr X, enter 'Bar' in the Foo field
      • Create a new advanced search for Foo = 'Bar'
      • Actions > Group - Create smart group
      • Note 1 person in the group
      • In custom field settings, 'Disable' the 'Foo' field
      • Clear the caches
      • Note 1000 people in the group

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                john John K.
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: