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) »
  • Get Activity Statuses via API
Pages: [1]

Author Topic: Get Activity Statuses via API  (Read 366 times)

Spry_Julia

  • I’m new here
  • *
  • Posts: 13
  • Karma: 0
  • CiviCRM version: 4
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5
Get Activity Statuses via API
June 08, 2014, 05:44:08 pm
I'm adding activities to contacts via the API. I'd like to not hard-code activity status IDs in my code, but I can't figure out how to get an activity status ID, or a list of activity statuses, via the API. Could anyone provide an example or point me to a direction?

Thanks!

Julia

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Get Activity Statuses via API
June 08, 2014, 06:19:37 pm
You can get acceptable options for most fields using getoptions - eg.
https://github.com/civicrm/civicrm-core/blob/master/api/v3/examples/Contact/Getoptions.php

Note that usually you can use either the id or the value e.g

civicrm_api3('activity', 'get', array('status_id' => 'Completed')):

should work the same as passing the id
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Spry_Julia

  • I’m new here
  • *
  • Posts: 13
  • Karma: 0
  • CiviCRM version: 4
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5
Re: Get Activity Statuses via API
June 08, 2014, 08:02:41 pm
Thank you! I ended up needing the whole list, so getoptions was exactly what I needed. Also, thanks for letting me know I could pass the value. I wasn't aware of that.


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Get Activity Statuses via API

This forum was archived on 2017-11-26.