I'm managing a country-wide organization's membership database with 1 membership type (you're either a member or you're not). Each region or province/state is represented by a Group.

This allows us to create an online roster (membership listing) that can be filtered by the regions across the country.

All of the updates to contact records and membership records (renewals) are handled via CSV imports.

For improving the maintenance of the CRM information, my goal is to run a search memberships report for current/new members which I can then split by region. I can then send the exec-admins governing each region their piece of the report so they will have a unified spreadsheet for managing addition and updates to the members they govern, making imports smoother to update contact records and membership renewals.

The issue I am running into is exporting a membership CSV spreadsheet that includes the all important Group or Group ID number. Any thoughts?

2 Answers 2


I've run into an almost identical problem, which I solved with a custom extension. I've hardcoded which groups correspond to chapters, and whenever someone is added to a group, I check if it's a "chapter" group. If so, I update a custom field with their chapter name, so I can export it. I could upload the entire extension to Github if you like, but the relevant code is here.

function membershipcards_civicrm_post($op, $objectName, $objectId, &$objectRef) { //set the chapter name for membership cards if(($op == 'create' || $op == 'edit') && $objectName == 'GroupContact'){ $params = array( 'version' => 3, 'sequential' => 1, 'contact_id' => $objectRef[0], ); $result = civicrm_api('GroupContact', 'get', $params); //cycle through the groups. If you find one that's a chapter //(currently hardcoded as gid <= 83), return its title. foreach($result['values'] as $key => $value){ if($value['group_id'] <= 83) { $chapter = $value['title']; break; } } $params = array( 'version' => 3, 'sequential' => 1, 'custom_98' => $chapter, 'id' => $objectRef[0], ); $result = civicrm_api('Contact', 'create', $params); } }

  • Hi Jon, I think your approach may be the best way to go about it. I'll have to think about it a little more in detail but it sounds like a good approach. There are some edge cases whereindividuals belongs to more than one region (that doesn't make sense but it happens). Overall I think this will at least take care of the lion's share of the export. Mar 27, 2015 at 16:43

Groups is not available as a field when using the Member export. Note that it is available when using the contact export in case that is of any help but I guess not since given you are trying to do renewals via CSV you probably want to see membership fields in the export.

One 'lowtech' solution would be to do two exports - one of your membership data and one with contact data (potentially filtered to members) and then use a tool that can merge these two data sources. Pretty sure that Excel's vlookup function can handle that kind of thing quite easily but I don't really use it much.

Else you could commission someone (the core team for instance) to get the group field export added to the membership export.

  • Thanks Michael. The lowtech method is what I've been doing up until now but a single export without VLOOKUP would be preferable. Mar 25, 2015 at 23:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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