3 * Test Generated example of using activity getfields API.
8 function activity_getfields_example() {
14 $result = civicrm_api3('activity', 'getfields', $params);
16 catch (CiviCRM_API3_Exception
$e) {
18 $errorMessage = $e->getMessage();
19 $errorCode = $e->getErrorCode();
20 $errorData = $e->getExtraParams();
22 'error' => $errorMessage,
23 'error_code' => $errorCode,
24 'error_data' => $errorData,
32 * Function returns array of result expected from previous function.
37 function activity_getfields_expectedresult() {
39 $expectedResult = array(
44 'source_record_id' => array(
45 'name' => 'source_record_id',
47 'title' => 'Source Record',
49 'activity_type_id' => array(
50 'name' => 'activity_type_id',
52 'title' => 'Activity Type ID',
55 'where' => 'civicrm_activity.activity_type_id',
56 'headerPattern' => '/(activity.)?type(.id$)/i',
62 'pseudoconstant' => array(
63 'optionGroupName' => 'activity_type',
66 'activity_date_time' => array(
67 'name' => 'activity_date_time',
69 'title' => 'Activity Date',
71 'where' => 'civicrm_activity.activity_date_time',
72 'headerPattern' => '/(activity.)?date(.time$)?/i',
75 'type' => 'Select Date',
81 'title' => 'Phone (called) ID',
82 'FKClassName' => 'CRM_Core_DAO_Phone',
84 'type' => 'Autocomplete-Select',
86 'FKApiName' => 'Phone',
88 'phone_number' => array(
89 'name' => 'phone_number',
91 'title' => 'Phone (called) Number',
98 'priority_id' => array(
99 'name' => 'priority_id',
101 'title' => 'Priority',
105 'pseudoconstant' => array(
106 'optionGroupName' => 'priority',
109 'parent_id' => array(
110 'name' => 'parent_id',
112 'title' => 'Parent Activity Id',
113 'FKClassName' => 'CRM_Activity_DAO_Activity',
114 'FKApiName' => 'Activity',
121 'relationship_id' => array(
122 'name' => 'relationship_id',
124 'title' => 'Relationship Id',
126 'FKClassName' => 'CRM_Contact_DAO_Relationship',
127 'FKApiName' => 'Relationship',
129 'is_current_revision' => array(
130 'name' => 'is_current_revision',
132 'title' => 'Is this activity a current revision in versioning chain?',
134 'where' => 'civicrm_activity.is_current_revision',
135 'headerPattern' => '/(is.)?(current.)?(revision|version(ing)?)/i',
139 'type' => 'CheckBox',
142 'original_id' => array(
143 'name' => 'original_id',
145 'title' => 'Original Activity ID ',
146 'FKClassName' => 'CRM_Activity_DAO_Activity',
147 'FKApiName' => 'Activity',
160 'title' => 'Activity ID',
163 'where' => 'civicrm_activity.id',
165 'uniqueName' => 'activity_id',
166 'api.aliases' => array(
167 '0' => 'activity_id',
173 'title' => 'Subject',
177 'where' => 'civicrm_activity.subject',
178 'headerPattern' => '/(activity.)?subject/i',
183 'uniqueName' => 'activity_subject',
186 'name' => 'duration',
188 'title' => 'Duration',
190 'where' => 'civicrm_activity.duration',
191 'headerPattern' => '/(activity.)?duration(s)?$/i',
196 'uniqueName' => 'activity_duration',
199 'name' => 'location',
201 'title' => 'Location',
205 'where' => 'civicrm_activity.location',
206 'headerPattern' => '/(activity.)?location$/i',
211 'uniqueName' => 'activity_location',
216 'title' => 'Details',
220 'where' => 'civicrm_activity.details',
221 'headerPattern' => '/(activity.)?detail(s)?$/i',
224 'type' => 'RichTextEditor',
226 'uniqueName' => 'activity_details',
228 'status_id' => array(
229 'name' => 'status_id',
231 'title' => 'Activity Status',
233 'where' => 'civicrm_activity.status_id',
234 'headerPattern' => '/(activity.)?status(.label$)?/i',
238 'pseudoconstant' => array(
239 'optionGroupName' => 'activity_status',
241 'uniqueName' => 'activity_status_id',
242 'api.aliases' => array(
243 '0' => 'activity_status',
251 'where' => 'civicrm_activity.is_test',
252 'headerPattern' => '/(is.)?test(.activity)?/i',
257 'uniqueName' => 'activity_is_test',
259 'medium_id' => array(
260 'name' => 'medium_id',
262 'title' => 'Activity Medium',
267 'pseudoconstant' => array(
268 'optionGroupName' => 'encounter_medium',
270 'uniqueName' => 'activity_medium_id',
281 'uniqueName' => 'activity_result',
283 'is_deleted' => array(
284 'name' => 'is_deleted',
286 'title' => 'Activity is in the Trash',
288 'where' => 'civicrm_activity.is_deleted',
289 'headerPattern' => '/(activity.)?(trash|deleted)/i',
294 'uniqueName' => 'activity_is_deleted',
296 'campaign_id' => array(
297 'name' => 'campaign_id',
299 'title' => 'Campaign',
301 'where' => 'civicrm_activity.campaign_id',
303 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
305 'type' => 'CheckBox',
307 'pseudoconstant' => array(
308 'table' => 'civicrm_campaign',
310 'labelColumn' => 'title',
312 'uniqueName' => 'activity_campaign_id',
313 'FKApiName' => 'Campaign',
315 'engagement_level' => array(
316 'name' => 'engagement_level',
318 'title' => 'Engagement Index',
320 'where' => 'civicrm_activity.engagement_level',
325 'pseudoconstant' => array(
326 'optionGroupName' => 'engagement_index',
328 'uniqueName' => 'activity_engagement_level',
330 'source_contact_id' => array(
331 'name' => 'source_contact_id',
332 'title' => 'Activity Source Contact',
334 'FKClassName' => 'CRM_Activity_DAO_ActivityContact',
335 'api.default' => 'user_contact_id',
337 'assignee_contact_id' => array(
338 'name' => 'assignee_id',
339 'title' => 'assigned to',
341 'FKClassName' => 'CRM_Activity_DAO_ActivityContact',
343 'target_contact_id' => array(
344 'name' => 'target_id',
345 'title' => 'Activity Target',
347 'FKClassName' => 'CRM_Activity_DAO_ActivityContact',
352 return $expectedResult;
356 * This example has been generated from the API test suite.
357 * The test that created it is called
359 * and can be found in
360 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
362 * You can see the outcome of the API tests at
363 * https://test.civicrm.org/job/CiviCRM-master-git/
365 * To Learn about the API read
366 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
368 * Browse the api on your own site with the api explorer
369 * http://MYSITE.ORG/path/to/civicrm/api
371 * Read more about testing here
372 * http://wiki.civicrm.org/confluence/display/CRM/Testing
374 * API Standards documentation:
375 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards