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) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Updating case activities with the api
Pages: [1]

Author Topic: Updating case activities with the api  (Read 1581 times)

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Updating case activities with the api
September 02, 2011, 04:52:02 am
Hi,
It looks like calling civicrm_api('activity','update') doesn't create an activity revision for case activities. It seems case-aware because it will create the case_activity record for new activities, but when you update it doesn't make the revision. Compare for example with CRM_Case_Form_Activity::postProcess around line 516 and beyond.

Just wondering if this is by design and the caller is expected to do this?

Thanks

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Updating case activities with the api
September 02, 2011, 04:57:25 am
It should.  Could you try using api.activity.create instead of update (with the id set), see if it updates?

What's the return of the api call?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: Updating case activities with the api
September 02, 2011, 09:31:43 am
Update just calls create behind the scenes.

The return is fine - it updates the activity fine - it just doesn't create a revision, probably because non-case activities don't have revisions. I'm just wondering if I fix the code will that break other people's code because they are expected to do the revisioning themselves. Or is it that the api hasn't been used much with Case and so the problem hasn't been noticed.

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: Updating case activities with the api
September 04, 2011, 06:04:43 am
I found another function in api/v3/Case.php::civicrm_api3_case_activity_create, but it does the same thing as the regular activity create/update just slightly differently. I'd suggest deprecating it as a duplicate?

Since nobody's objected I'll fix the regular activity call to handle revisions for case activities. (http://issues.civicrm.org/jira/browse/CRM-8798)

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Updating case activities with the api
September 05, 2011, 12:47:51 pm
Agreed. case_activity_create is redundant. It's my fault... I wrote it when I wrote the case API because at the time the activity API was incompatible with cases.
Deleting it and fixing activity.php is definitely the way to go.
Try asking your question on the new CiviCRM help site.

sivani

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.4.6
  • CMS version: Drupal 7
  • MySQL version: 5.5
  • PHP version: 5
Re: Updating case activities with the api
May 27, 2015, 12:53:24 am
I created case civicrm_api3('case', 'create', $params); through this function but i want to create case inside activity tell me which function i have to use in civicrm api?????

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Updating case activities with the api

This forum was archived on 2017-11-26.