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) »
  • How can we change an activity type after it's posted?
Pages: [1]

Author Topic: How can we change an activity type after it's posted?  (Read 1225 times)

mlampard

  • I post occasionally
  • **
  • Posts: 42
  • Karma: 3
How can we change an activity type after it's posted?
February 15, 2010, 11:11:19 pm
We have a custom activity type called STS, which needs to be changed in some cases to phone call, some to email, some to mail out etc. I tried doing this at the DB level via:
update civicrm_activity set activity_type_id = 2 where activity_type_id = 35 and subject like '%phone%' (or something like that).

Doing this seemed at first to work, but then it became apparent that every record I changed was excluded from search results when doing a search for contacts with the relevant parameters! I restored the civicrm_activity table from backup, but ended up having to completely restore the entire database, as nothing would come up in the search results until I did.

Can anyone help me here? Running civicrm version 2.2.8 and about to upgrade to 3.1.2, on Drupal 5x. I'm comfortable working in SQL, but I'm not sure what I'm corrupting when I do these changes in the back end.

Cheers,
Marty.

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: How can we change an activity type after it's posted?
February 16, 2010, 03:18:13 am
Your query seems to be correct. Which search did you use?

Quote
Running civicrm version 2.2.8 and about to upgrade to 3.1.2, on Drupal 5x.

Are you running 2.2.8 on drupal 5 ?

Kurund

Found this reply helpful? Support CiviCRM

mlampard

  • I post occasionally
  • **
  • Posts: 42
  • Karma: 3
Re: How can we change an activity type after it's posted?
February 16, 2010, 07:34:35 am
No, Drupal 6.10 (forgot that I'd upgraded, sorry).

Searched using Find Contacts/Advanced Search/Activities and then put %some_text_I_know_is_in_the_subject% in the subject and hit the "Search" button. Zero results!

Also, when viewing activities for a contact that I changed the activity type for, the activity that I changed does NOT come up in the list of activities.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: How can we change an activity type after it's posted?
February 16, 2010, 08:13:12 am
Marty - just did a quick test on my local 3.1.3 install where I created activity of type = Phone Call, then updated activity_type_id in MySQL from '2' to '1' for that activity record. Search and display in contact tab worked fine. Not sure what's going on in your case - since this aspect of the schema hasn't changed afaik. You might try doing it for one record and see if that gives you clues.
Protect your investment in CiviCRM by  becoming a Member!

mlampard

  • I post occasionally
  • **
  • Posts: 42
  • Karma: 3
Re: How can we change an activity type after it's posted?
February 22, 2010, 09:38:29 am
Hmmm, interesting - doing these one at a time seems just fine, but when I did them in bulk it "corrupted". A thought occurred to me though - if civicrm uses smarty in an MVC framework, perhaps what I'm seeing is a cache corruption of the smarty file - I've seen this before where I had to remove everything in the templates_c directory - I'll try it again in bulk and see what happens....

mlampard

  • I post occasionally
  • **
  • Posts: 42
  • Karma: 3
Re: How can we change an activity type after it's posted?
February 22, 2010, 01:14:21 pm
OK, digging deeper here's what I've found:
I have a custom data set for activities called SAR Information. This set has a required field (Species) and is set searchable. This creates a table called civicrm_value_sar_information_14. If I add a record to this table at the DB level (insert into civicrm_value_sar_information_14 (entity_id, species_102) values (14928,'R_COTE')), then do a search for activities that have R_COTE in the Species field, it won't pick it up. Further to this, if I go into the Activities tab for the user and pull up the activity in view mode, it shows that R_COTE is set for this activity. However, if I go into this activity record in edit mode, it shows NO value in this field!

I have added 2 screen shots of this. First one of these is viewing the activity at url:
.../?q=civicrm/contact/view/activity&atype=2&action=view&reset=1&id=14928&cid=13416&context=activity

the second is editing the activity at url:
.../?q=civicrm/contact/view/activity&atype=2&action=update&reset=1&id=14928&cid=13416&context=activity

As you can see, everything is identical, except for the action parameter. I need to update 798 activity records in this manner (i.e. at the DB level), so need to get this sorted - HELP!!!
Cheers,
Marty.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: How can we change an activity type after it's posted?
February 22, 2010, 03:47:46 pm
Values in custom field columns with multiple selection options (like your checkbox) require Ctrl+A delimiters (even if there's only a single value set for that row).

Code: [Select]
Health CareWorkers Rights
Protect your investment in CiviCRM by  becoming a Member!

mlampard

  • I post occasionally
  • **
  • Posts: 42
  • Karma: 3
Re: How can we change an activity type after it's posted?
February 22, 2010, 08:21:52 pm
Hmmm, OK, excuse my ignorance, but how do i get the ctrl+a character into the data stream - can't say I've ever had to do that before that I can remember....

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 can we change an activity type after it's posted?
February 22, 2010, 09:44:29 pm

if u r doing this via sql, something like:

UPDATE tableName SET columnName = CONCAT(CHAR( 01 ), 'some value here', CHAR( 01 ));

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • How can we change an activity type after it's posted?

This forum was archived on 2017-11-26.