CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Activity Import without subject contact
Pages: [1]

Author Topic: Activity Import without subject contact  (Read 485 times)

boulderfuzz

  • I’m new here
  • *
  • Posts: 18
  • Karma: 0
  • CiviCRM version: 3.3.2
  • CMS version: Drupal 6.19
  • MySQL version: unknown
  • PHP version: unknown
Activity Import without subject contact
September 17, 2012, 05:00:21 pm
My organization is using CiviCRM Activities to track the activities of subcontractors.  We have the subcontractors enter their activities into a simple spreadsheet, then later import that spreadsheet as Activities.

This spreadsheet import solution has been working well for contractor activities which refer to a specific member - for example, "Import Data (row 3)" in the attached screenshot.  However, I run into problems trying to import what I call "self-referring activities", stuff a contractor does which cannot be referenced to a single member - "row 2" in the attached screenshot, where the matching CiviCRM field "Email (match to contact)" would be left blank.  When I attempt to import a self-referring activity, the import fails with error "No matching Contact found for ( )".  How can I import activities without matching Contact records?

I know the self-referring activity case is valid, as Civi automatically creates just these kind of self-referring activities automatically for actions such as sending an email.  If I use phpmyadmin to look at the tables, it appears that an activity referenced to a specific member creates a row in civicrm_activity_target; a self-referring activity does not create a row in this table.

So, my questions:
1) is the capability to import self-referring activities already present in Civi, but I'm just not going about it correctly?
2) if this capability is *not* already present in Civi, how do I add it?
2a) I suppose the answer to #2 is "modify XX file" - but which file(s), and how should it/they be modified?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Activity Import without subject contact
September 18, 2012, 03:58:36 am

Dont we add the contact id to the civicrm_activity_target table? we do so for most/all of the automatically generated activities in civicirm. email might be the exception as you've said

to answer your q's:

1. Dont think so

2. U'll need to modify CRM/Activity/Import/*

3. You'll need to loosen the rule that a target has to be present etc

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

boulderfuzz

  • I’m new here
  • *
  • Posts: 18
  • Karma: 0
  • CiviCRM version: 3.3.2
  • CMS version: Drupal 6.19
  • MySQL version: unknown
  • PHP version: unknown
Re: Activity Import without subject contact
September 21, 2012, 12:23:49 pm
Thanks Lobo.

Since I know very little PHP, I lack the skills to implement what you suggest. However, I did do a little sleuthing before stalling out and learned a couple things which might speed up the process for others who may someday find this thread and attempt it themselves.  :)

(a) the "No matching contact..." error originated from the "import" function in civicrm/CRM/Activity/Import/Parser/Activity.php
(b) the errors are thrown by function "civicrm_check_contact_dedupe", which is in civicrm/api/v2/utils.php

That's about where I stalled out.

As an alternative, I decided to create a new Individual contact and assign all self-referring activities to that contact.  Meaning, the activity is now "added by" a contractor and "with contact" is mapped to the new contact record I created.  Now that new contact's activity log will contain all actions by contractors which are not attributable to a real person.

Thanks again!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Activity Import without subject contact

This forum was archived on 2017-11-26.