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 Import (Moderator: Yashodha Chaku) »
  • How to import notes to existing contacts
Pages: [1]

Author Topic: How to import notes to existing contacts  (Read 2029 times)

daveatkins

  • I post occasionally
  • **
  • Posts: 68
  • Karma: 2
  • CiviCRM version: 4.1.6
  • CMS version: Drupal 6.28
  • MySQL version: 5.1.41
  • PHP version: 5.2.10
How to import notes to existing contacts
September 08, 2011, 07:01:42 am
I am trying to keep a civicrm database in sync with a legacy system until we can shut that off. I need to do an update import which works for most fields of the contacts, but causes duplicate notes to be added each time I do the import.

What I would like to do is isolate the notes import entirely so I can clean it up. What is the best way to import notes and correctly associate them with existing contacts?

I would
1) delete all existing notes
2) perform contact updates but ignore the notes field
3) do a separate export of contacts from the legacy system with notes, then do an update/(fill?) import with that file.

If it matters, the legacy system is ACT! v. 6.0

By the way...I have never seen a more difficult CAPTCHA! And you still require it even after registering?

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: How to import notes to existing contacts
September 08, 2011, 11:11:20 am

your plan seems fairly sound :)

regarding the captcha, yeah its a pain (or so we've heard). But on the flip side, the number of spam posts have gone down by 99% (or more)

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

daveatkins

  • I post occasionally
  • **
  • Posts: 68
  • Karma: 2
  • CiviCRM version: 4.1.6
  • CMS version: Drupal 6.28
  • MySQL version: 5.1.41
  • PHP version: 5.2.10
Re: How to import notes to existing contacts
September 08, 2011, 11:58:32 am
But how do I import the notes? It seems there can be multiple notes per contact...does it just add more if you have multiple rows in the csv import file that match the same email address? Should I update or fill? Is there a way to import so the existing notes are deleted?

I have a logical plan, but I do not know precisely how to execute it in civicrm.

daveatkins

  • I post occasionally
  • **
  • Posts: 68
  • Karma: 2
  • CiviCRM version: 4.1.6
  • CMS version: Drupal 6.28
  • MySQL version: 5.1.41
  • PHP version: 5.2.10
Re: How to import notes to existing contacts
September 16, 2011, 09:20:50 am
should I repost this question? Is it possible to import the notes? How does it work?

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: How to import notes to existing contacts
September 16, 2011, 10:39:39 am

There is no separate note import. You'll need to combine the notes into one big note and import it. Alternatively you can write a custom script that does note import using the v3 api

if you do so, please share your code, so others could reuse and benefit

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

daveatkins

  • I post occasionally
  • **
  • Posts: 68
  • Karma: 2
  • CiviCRM version: 4.1.6
  • CMS version: Drupal 6.28
  • MySQL version: 5.1.41
  • PHP version: 5.2.10
Re: How to import notes to existing contacts
September 19, 2011, 01:20:16 pm
What happened when I did multiple imports is that I had multiple notes added to contacts. So it seems like I should exclude the notes field from the import to avoid this happening anymore. Is there any documentation on this? Sorry, I looked and it does not describe this in the import/export. How Do I delete all the notes and start over? go directly into the database and delete from a table?

abeverley

  • I’m new here
  • *
  • Posts: 12
  • Karma: 3
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 7
  • MySQL version: 5.1.49 (Debian)
  • PHP version: 5.3.3 (Debian)
Re: How to import notes to existing contacts
March 27, 2012, 12:57:17 pm
Hi,

Did you ever get this sorted?

Due to various problems, I had to do multiple uploads, thinking that all fields would be overwritten. However, I've just seen that a lot of my entries have the same notes several times. I'd like to clear all the notes out, and then re-upload.

Andy

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: How to import notes to existing contacts
March 28, 2012, 01:26:46 am
I suggest an experiment.

Put one note on each row, and map that note to the contacts using whatever id (internal ID, external ID, email, etc).  It desirable for several rows to be for the same contact, with different notes in each row.

Your import file should have only 2 columns.

Make a backup, and try only on a few contacts (don't import ALL your data).

Select "no duplicate checking", "fill" and other settings on the import screen, and give that a whirl.   Does it work?

The desired results is multiple notes imported per contact.

Try CiviTeacher: the online video tutorial CiviCRM learning library.

abeverley

  • I’m new here
  • *
  • Posts: 12
  • Karma: 3
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 7
  • MySQL version: 5.1.49 (Debian)
  • PHP version: 5.3.3 (Debian)
Re: How to import notes to existing contacts
June 12, 2012, 03:47:13 pm
Thanks for the reply Stoob, but I was actually trying to remove duplicate notes rather than upload multiple notes.

In the end I did some SQL queries which seemed to work fine. These commands will remove any duplicate notes for the same contact ID:

Code: [Select]
create table tempnotes (id int);
insert into tempnotes (id) select id from civicrm_note group by contact_id,note;
delete from civicrm_note where id not in (select id from tempnotes);
drop table tempnotes

I dare say there's a tidier way of doing that with one SQL statement and temporary tables, but that worked for me.

This was with version 4.1.2

Also, I don't see why a simple
Code: [Select]
delete from civicrm_note wouldn't work to delete all comments, as the user above wanted to do.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • How to import notes to existing contacts

This forum was archived on 2017-11-26.