1

We have a bunch of smart groups that a lot of other smart groups rely on. I'd like to turn these former groups into regular groups and then generate them once a day, to improve performance. But deleting them and reconfiguring all the other groups with the replacements will be quite fiddly, so I'm wondering if I can convert them.

Has anyone tried this? Can I just edit civicrm_group to remove the:

  • saved_search_id
  • where_clause
  • select_tables
  • where_tables

? Just wondering if there are any gotchas I need to be aware of.

5

Unfortunately NO, updating saved_search_id to NULL will actually convert it to normal group but no contact's will get added into this group since for smart group the contact are calculated from civicrm_group_contact_cache table which is rebuild periodically and for normal group its from civicrm_group_contact which is static. So you will need to first rebuild the contacts for a group and then move data from cache to static table like

INSERT IGNORE INTO civicrm_group_contact (group_id, contact_id, status)
SELECT group_id, contact_id, 'Added' FROM civicrm_group_contact_cache 
  WHERE group_id IN (1);

HTH

Pradeep

  • Cool - that's what I was hoping! I'll be generating the group once a day from a script. Just wanted to check that removing the saved_search_id was all I needed to stop it being treated as a smart group. Thanks! – Andrew West Jul 18 '18 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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