5

Has anyone got tips for the best implementation for this that's friendly to a savvy end-user? I can script it in an ETL tool, but that's not an option for them.

  • "Import Activities", as best I can tell, will only import a single contact ID.
  • You can import more contacts via the ActivityContact API (with API CSV GUI Import extension) but this is hard, because there's no good way to match the imported activity to the CSV you imported from. Activities don't have an "external identifier" field.

The only real choice I see is to hijack an field I'm not using like "Engagement Level" and use that as a temporary "external identifier" - but that's pretty ugly.

Any other approaches short of building a custom import?

  • I've done a ton of importing of contacts and memberships. Had never tried activities. I just did and had no issues importing the exact same activity to several contacts. I used a cvs file, one line for each contact and the Import Activities off the Contacts menu, which I assume is what you tried. What kind of errors did you get? – Paul-Tahoe Apr 1 '15 at 17:32
  • Hi Paul - I was trying to import one activity per row, not one contact per row. I was hoping to specify multiple contact IDs per activity. I like your approach - but is there a way to specify that two activities are the same besides by activity ID? I'm trying to import activities that don't currently exist. – Jon G - Megaphone Tech Apr 1 '15 at 20:13
  • Ah yes. I see. I tried a bunch of things with not much success. What you'd want is for the record to try to match to some activity, if it doesn't create it, if it does just create the record in civicrm_activity_contact table. Even if you include a valid activity_id it didn't create additional records in activity_contact table in my testing. The structure of activity_contact table is simple. One thing you could do is to import one row to create the activity and then add the rows manually for the others to the activity_contact table. Not sure if you can give the user some way to do that. – Paul-Tahoe Apr 1 '15 at 23:13
1

I've tried various ways of importing complex entities. At the end of the day, the best tip I have to offer you is to write a small program to create the entities via the api.

You can either run it on the server (php) or run it over REST (php or my current favorite, node.js)

I found it much easier to deal with edge cases, errors, weird matching logic...

If you are on drupal, check Eileen work to integrate with the migration module

If you are prepared to invest a significant amount of time learning kettle, amnesty spain has shared a module to make it easier to pull or push data from civicrm.

  • Hi Xavier - I agree, Kettle is how I handle this when I do my own migrations - but in this case I'm specifically looking for a way to let end users import activities that have multiple contacts. – Jon G - Megaphone Tech Apr 8 '15 at 17:23

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.