I want to create a custom field that selects a CiviCRM group.

eg, the business logic is "when a person registers for an event and they select 'subscribe me to news of events like this' then add them to group X" where X is a custom field attached to the event.

I could create a custom field that is an integer, look up the Id of the group, and set the custom field to that number. It would be nicer to have a UI for that.

Any pointers? Cheers!


As you may already know, there is a field that will expose all groups that are mailing lists to the user and let them select, which one they want to subscribe to. You could add this field to the profile that you use for events. It is descirben on this page (see "Using a profile"). However, users would be presented with all public mailing groups available.

As an alternative, you could also create a custom field (I would recommend a contact field but you could also use an event field) and give the users the opportunity to tick that field/option. You could then create a smart (mailing) group (which is also described on the page linked above) that includes all people who selected the option.

Both options do not require any coding at all and can be done via the UI.

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.