1

I am attempting to export Memberships and Contributions. When I export Memberships, there is no field to export associated Contribution records/IDs. When I export Contributions, there is not field to export the associated Membership (if it was a membership).

Currently, the only unique ID on the Contributions is the Contact ID - but a Contact can have multiple contributions (i.e. membership purchase, renewal, event sign up, etc.)

How can I export the related/associated Membership ID for a Contribution?

Alternatively, I thought it could work to export the Memberships if they included the Contribution amount. But that is also not an option on the Membership export, only Recurring Contribution ID.

2 Answers 2

1

This is straightforward with Search Kit. Below is a search you can import into Search Kit. I've only added Contribution ID and Membership ID to the columns, but you can add whatever other fields you like.

I'm also adding a screenshot in case your CiviCRM version isn't new enough to support Search Kit imports:

enter image description here

[
  [
    "SavedSearch",
    "save",
    {
      "records": [
        {
          "name": "Contributions_with_Memberships",
          "label": "Contributions with Memberships",
          "form_values": null,
          "search_custom_id": null,
          "api_entity": "Contribution",
          "api_params": {
            "version": 4,
            "select": [
              "id",
              "Contribution_LineItem_contribution_id_01_LineItem_Membership_entity_id_01.id"
            ],
            "orderBy": [],
            "where": [],
            "groupBy": [],
            "join": [
              [
                "LineItem AS Contribution_LineItem_contribution_id_01",
                "INNER",
                [
                  "id",
                  "=",
                  "Contribution_LineItem_contribution_id_01.contribution_id"
                ]
              ],
              [
                "Membership AS Contribution_LineItem_contribution_id_01_LineItem_Membership_entity_id_01",
                "INNER",
                [
                  "Contribution_LineItem_contribution_id_01.entity_id",
                  "=",
                  "Contribution_LineItem_contribution_id_01_LineItem_Membership_entity_id_01.id"
                ],
                [
                  "Contribution_LineItem_contribution_id_01.entity_table",
                  "=",
                  "'civicrm_membership'"
                ]
              ]
            ],
            "having": []
          },
          "expires_date": null,
          "description": null,
          "mapping_id": null
        }
      ],
      "match": [
        "name"
      ]
    }
  ]
]
0

Depending on exactly what you want, you may be able to use the Contributions and Membership report, filtering on Finance type for membership and then exporting as CSV. But you'd need to do a bit of work in it as the contact info isn't shown on every line.

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.