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',
49 'pseudoconstant' => array(
50 'optionGroupName' => 'activity_type',
53 'activity_date_time' => array(
54 'name' => 'activity_date_time',
56 'title' => 'Activity Date',
58 'where' => 'civicrm_activity.activity_date_time',
59 'headerPattern' => '/(activity.)?date(.time$)?/i',
65 'title' => 'Phone (called) ID',
66 'FKClassName' => 'CRM_Core_DAO_Phone',
68 'phone_number' => array(
69 'name' => 'phone_number',
71 'title' => 'Phone (called) Number',
75 'priority_id' => array(
76 'name' => 'priority_id',
78 'title' => 'Priority',
79 'pseudoconstant' => array(
80 'optionGroupName' => 'priority',
84 'name' => 'parent_id',
86 'title' => 'Parent Activity Id',
87 'FKClassName' => 'CRM_Activity_DAO_Activity',
94 'relationship_id' => array(
95 'name' => 'relationship_id',
97 'title' => 'Relationship Id',
99 'FKClassName' => 'CRM_Contact_DAO_Relationship',
101 'is_current_revision' => array(
102 'name' => 'is_current_revision',
104 'title' => 'Is this activity a current revision in versioning chain?',
106 'where' => 'civicrm_activity.is_current_revision',
107 'headerPattern' => '/(is.)?(current.)?(revision|version(ing)?)/i',
111 'original_id' => array(
112 'name' => 'original_id',
114 'title' => 'Original Activity ID ',
115 'FKClassName' => 'CRM_Activity_DAO_Activity',
125 'title' => 'Activity ID',
128 'where' => 'civicrm_activity.id',
130 'uniqueName' => 'activity_id',
131 'api.aliases' => array(
132 '0' => 'activity_id',
138 'title' => 'Subject',
142 'where' => 'civicrm_activity.subject',
143 'headerPattern' => '/(activity.)?subject/i',
145 'uniqueName' => 'activity_subject',
148 'name' => 'duration',
150 'title' => 'Duration',
152 'where' => 'civicrm_activity.duration',
153 'headerPattern' => '/(activity.)?duration(s)?$/i',
155 'uniqueName' => 'activity_duration',
158 'name' => 'location',
160 'title' => 'Location',
164 'where' => 'civicrm_activity.location',
165 'headerPattern' => '/(activity.)?location$/i',
167 'uniqueName' => 'activity_location',
172 'title' => 'Details',
176 'where' => 'civicrm_activity.details',
177 'headerPattern' => '/(activity.)?detail(s)?$/i',
179 'uniqueName' => 'activity_details',
181 'status_id' => array(
182 'name' => 'status_id',
184 'title' => 'Activity Status Id',
186 'where' => 'civicrm_activity.status_id',
187 'headerPattern' => '/(activity.)?status(.label$)?/i',
188 'pseudoconstant' => array(
189 'optionGroupName' => 'activity_status',
191 'uniqueName' => 'activity_status_id',
192 'api.aliases' => array(
193 '0' => 'activity_status',
201 'where' => 'civicrm_activity.is_test',
202 'headerPattern' => '/(is.)?test(.activity)?/i',
204 'uniqueName' => 'activity_is_test',
206 'medium_id' => array(
207 'name' => 'medium_id',
209 'title' => 'Activity Medium',
211 'pseudoconstant' => array(
212 'optionGroupName' => 'encounter_medium',
214 'uniqueName' => 'activity_medium_id',
222 'uniqueName' => 'activity_result',
224 'is_deleted' => array(
225 'name' => 'is_deleted',
227 'title' => 'Activity is in the Trash',
229 'where' => 'civicrm_activity.is_deleted',
230 'headerPattern' => '/(activity.)?(trash|deleted)/i',
232 'uniqueName' => 'activity_is_deleted',
234 'campaign_id' => array(
235 'name' => 'campaign_id',
237 'title' => 'Campaign',
239 'where' => 'civicrm_activity.campaign_id',
241 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
242 'pseudoconstant' => array(
243 'table' => 'civicrm_campaign',
245 'labelColumn' => 'title',
247 'uniqueName' => 'activity_campaign_id',
249 'engagement_level' => array(
250 'name' => 'engagement_level',
252 'title' => 'Engagement Index',
254 'where' => 'civicrm_activity.engagement_level',
256 'pseudoconstant' => array(
257 'optionGroupName' => 'engagement_index',
259 'uniqueName' => 'activity_engagement_level',
261 'source_contact_id' => array(
262 'name' => 'source_contact_id',
263 'title' => 'Activity Source Contact',
265 'FKClassName' => 'CRM_Activity_DAO_ActivityContact',
266 'api.default' => 'user_contact_id',
268 'assignee_contact_id' => array(
269 'name' => 'assignee_id',
270 'title' => 'assigned to',
272 'FKClassName' => 'CRM_Activity_DAO_ActivityContact',
274 'target_contact_id' => array(
275 'name' => 'target_id',
276 'title' => 'Activity Target',
278 'FKClassName' => 'CRM_Activity_DAO_ActivityContact',
283 return $expectedResult;
288 * This example has been generated from the API test suite. The test that created it is called
290 * testGetFields and can be found in
291 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
293 * You can see the outcome of the API tests at
294 * https://test.civicrm.org/job/CiviCRM-master-git/
296 * To Learn about the API read
297 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
299 * Browse the api on your own site with the api explorer
300 * http://MYSITE.ORG/path/to/civicrm/api/explorer
302 * Read more about testing here
303 * http://wiki.civicrm.org/confluence/display/CRM/Testing
305 * API Standards documentation:
306 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards