We've got CiviDiscount working to apply the appropriate discounts for memberships and events, but would like to be able to add all contacts that have used a discount to a report (for our sponsors) or smart group. When I go to the CiviDiscount page, I can see the list of contacts who've redeemed each code, but would like to be able to search and act on that information. So I guess my question is how can I add a Custom search for codes redeemed?

We have made a participants view in Drupal that shows all event participants who have redeemed a code. We can then add them to a group for use in further searches in Civi.

I don't know how you would do this with a smart group, but at least this might get you part of the way.

We'll be doing a similar thing for memberships in due course, if that's possible.

To do this you need: Drupal, Civicrm entity (ours is beta9), and turn on the sub module: civicrm_entity_actions as Pete mentions in the comments to the first answer here: How to configure Views VBO action to disable relationships? You also need Views Bulk Operations

The participant view needs to have this relationship: CiviCRM Contributions: Contact Record ID

The view also needs to have an exposed filter of the Participants fee level field. (NB, don't confuse this with the Events Fee level or the Contribution Amount label fields. They won't produce the same results).

Then you can filter your view by keywords from your codes.

Add the field, (CiviCRM Contact, with custom fields) Bulk operations: CiviCRM Contact. Note this will need a relationship to Civicrm Contact. Initially it won't give you the option to add a group, but after saving the field and then re-editing it you will see Add contact to group as an option.

You will have had to previously made a suitable group in Civi.

Et Voila! Now you can bulk add participants who've used your code to your group.

I can send you an export of the view if that's helpful. Good luck!

NB: it might be helpful to know that the Contributions: Amount label field will work fine for this purpose for online event bookings. But bookings taken through the admin interface may not contain the discount code in the Amount label field.

Karin Gerritsen has created an update to the Extended Reports module to allow any discount codes to be exposed in a report, with various actions that can then be run on the search result, which is exactly what I wanted. Previously the Extended reports only worked on discount codes for events, not for memberships. Can ExtendedReports report on CiviDiscount usage?

Andy's solution is related to what you ask, and Eli Lisseck's CiviDiscount report is too - but none of these will give you a custom search, which you need for a smart group.

There's documentation on creating custom searches here. I think that if you write this extension, it'd be great to submit an answer to this question with a link to the Github!

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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