2

I'm using the REST interface and the create case API to create a new case. The case is created, but no activities. In particular, no "Open Case" activity is created as I would have expected. No entry is created in the civicrm_case_activity table. As a consequence (or maybe this is just a coincidence), the Case does not show up in search results. If I edit the case, then a Change Case entry is created in the civicrm_case_activity table and the case then appears in search reports.

Do I need to explicitly create an Open Case activity? For example by chaining api.Activity.create json on to the Case create json? Thanks.

CiviCRM 5.10.4 Joomla 3.9.2 PHP 7.0.33

  • 1
    I assume there is an Open Case activity in the definition of your case type? – ErikH - CiviCooP Feb 28 at 14:08
  • Erik might have a good point. It works for me ok using curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d @foo.txt http://url/sites/all/modules/civicrm/extern/rest.php with foo.txt containing entity=Case&action=create&api_key=my-user-key&key=the-site-key&json={"contact_id":"user_contact_id","subject":"test","case_type_id":"housing_support"}. The url would be different for joomla - mine is drupal. – Demerit Feb 28 at 15:37
  • Yup. That was it. In fact I needed to include the Open Case activity in the case type and also in its standard timeline. Thank you! – Jern Feb 28 at 16:49
  • @ErikH-CiviCooP Would you like to make that your answer, so I can accept it? Otherwise I will write an answer. Thanks again. – Jern Feb 28 at 19:07
1

You probably do not have an Open Case activity configured for your case type.

2

Answer (thanks to @ErikH and @Demerit): the problem was that the case type did not have an Open Case activity in its standard timeline (presumably I had deleted it). Anyway, I added the Open Case activity to the standard timeline, and subsequently-created cases have been fine.

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.