3 * Test Generated example of using activity getfields API
6 function activity_getfields_example(){
12 $result = civicrm_api3('activity', 'getfields', $params);
14 catch (CiviCRM_API3_Exception
$e) {
16 $errorMessage = $e->getMessage();
17 $errorCode = $e->getErrorCode();
18 $errorData = $e->getExtraParams();
19 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
26 * Function returns array of result expected from previous function
28 function activity_getfields_expectedresult(){
30 $expectedResult = array(
35 'source_record_id' => array(
36 'name' => 'source_record_id',
38 'title' => 'Source Record',
40 'activity_type_id' => array(
41 'name' => 'activity_type_id',
43 'title' => 'Activity Type ID',
46 'where' => 'civicrm_activity.activity_type_id',
47 'headerPattern' => '/(activity.)?type(.id$)/i',
48 'pseudoconstant' => array(
49 'optionGroupName' => 'activity_type',
52 'activity_date_time' => array(
53 'name' => 'activity_date_time',
55 'title' => 'Activity Date',
57 'where' => 'civicrm_activity.activity_date_time',
58 'headerPattern' => '/(activity.)?date(.time$)?/i',
64 'title' => 'Phone (called) ID',
65 'FKClassName' => 'CRM_Core_DAO_Phone',
67 'phone_number' => array(
68 'name' => 'phone_number',
70 'title' => 'Phone (called) Number',
74 'priority_id' => array(
75 'name' => 'priority_id',
77 'title' => 'Priority',
78 'pseudoconstant' => array(
79 'optionGroupName' => 'priority',
83 'name' => 'parent_id',
85 'title' => 'Parent Activity Id',
86 'FKClassName' => 'CRM_Activity_DAO_Activity',
93 'relationship_id' => array(
94 'name' => 'relationship_id',
96 'title' => 'Relationship Id',
98 'FKClassName' => 'CRM_Contact_DAO_Relationship',
100 'is_current_revision' => array(
101 'name' => 'is_current_revision',
103 'title' => 'Is this activity a current revision in versioning chain?',
105 'where' => 'civicrm_activity.is_current_revision',
106 'headerPattern' => '/(is.)?(current.)?(revision|version(ing)?)/i',
109 'original_id' => array(
110 'name' => 'original_id',
112 'title' => 'Original Activity ID ',
113 'FKClassName' => 'CRM_Activity_DAO_Activity',
123 'title' => 'Activity ID',
126 'where' => 'civicrm_activity.id',
128 'uniqueName' => 'activity_id',
129 'api.aliases' => array(
130 '0' => 'activity_id',
136 'title' => 'Subject',
140 'where' => 'civicrm_activity.subject',
141 'headerPattern' => '/(activity.)?subject/i',
143 'uniqueName' => 'activity_subject',
146 'name' => 'duration',
148 'title' => 'Duration',
150 'where' => 'civicrm_activity.duration',
151 'headerPattern' => '/(activity.)?duration(s)?$/i',
153 'uniqueName' => 'activity_duration',
156 'name' => 'location',
158 'title' => 'Location',
162 'where' => 'civicrm_activity.location',
163 'headerPattern' => '/(activity.)?location$/i',
165 'uniqueName' => 'activity_location',
170 'title' => 'Details',
174 'where' => 'civicrm_activity.details',
175 'headerPattern' => '/(activity.)?detail(s)?$/i',
177 'uniqueName' => 'activity_details',
179 'status_id' => array(
180 'name' => 'status_id',
182 'title' => 'Activity Status Id',
184 'where' => 'civicrm_activity.status_id',
185 'headerPattern' => '/(activity.)?status(.label$)?/i',
186 'pseudoconstant' => array(
187 'optionGroupName' => 'activity_status',
189 'uniqueName' => 'activity_status_id',
196 'where' => 'civicrm_activity.is_test',
197 'headerPattern' => '/(is.)?test(.activity)?/i',
199 'uniqueName' => 'activity_is_test',
201 'medium_id' => array(
202 'name' => 'medium_id',
204 'title' => 'Activity Medium',
206 'pseudoconstant' => array(
207 'optionGroupName' => 'encounter_medium',
209 'uniqueName' => 'activity_medium_id',
217 'uniqueName' => 'activity_result',
219 'is_deleted' => array(
220 'name' => 'is_deleted',
222 'title' => 'Activity is in the Trash',
224 'where' => 'civicrm_activity.is_deleted',
225 'headerPattern' => '/(activity.)?(trash|deleted)/i',
227 'uniqueName' => 'activity_is_deleted',
229 'campaign_id' => array(
230 'name' => 'campaign_id',
232 'title' => 'Campaign ID',
234 'where' => 'civicrm_activity.campaign_id',
236 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
237 'uniqueName' => 'activity_campaign_id',
239 'engagement_level' => array(
240 'name' => 'engagement_level',
242 'title' => 'Engagement Index',
244 'where' => 'civicrm_activity.engagement_level',
246 'pseudoconstant' => array(
247 'optionGroupName' => 'engagement_index',
249 'uniqueName' => 'activity_engagement_level',
251 'source_contact_id' => array(
252 'name' => 'source_contact_id',
253 'title' => 'Activity Source Contact',
255 'FKClassName' => 'CRM_Activity_DAO_ActivityContact',
256 'api.default' => 'user_contact_id',
258 'assignee_contact_id' => array(
259 'name' => 'assignee_id',
260 'title' => 'assigned to',
262 'FKClassName' => 'CRM_Activity_DAO_ActivityContact',
264 'target_contact_id' => array(
265 'name' => 'target_id',
266 'title' => 'Activity Target',
268 'FKClassName' => 'CRM_Activity_DAO_ActivityContact',
273 return $expectedResult;
278 * This example has been generated from the API test suite. The test that created it is called
280 * testGetFields and can be found in
281 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ActivityTest.php
283 * You can see the outcome of the API tests at
284 * http://tests.dev.civicrm.org/trunk/results-api_v3
286 * To Learn about the API read
287 * http://book.civicrm.org/developer/current/techniques/api/
289 * and review the wiki at
290 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
292 * Read more about testing here
293 * http://wiki.civicrm.org/confluence/display/CRM/Testing
295 * API Standards documentation:
296 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards