4 * Test Generated API Example.
5 * See bottom of this file for more detail.
9 * Test Generated example of using activity Create API.
11 * demonstrates create with Contact Reference Custom Field
16 function activity_create_example() {
18 'source_contact_id' => 1,
19 'activity_type_id' => '51',
20 'subject' => 'test activity type id',
21 'activity_date_time' => '2011-06-02 14:36:13',
25 'location' => 'Pennsylvania',
26 'details' => 'a test activity',
31 $result = civicrm_api3('activity', 'Create', $params);
33 catch (CiviCRM_API3_Exception
$e) {
35 $errorMessage = $e->getMessage();
36 $errorCode = $e->getErrorCode();
37 $errorData = $e->getExtraParams();
39 'error' => $errorMessage,
40 'error_code' => $errorCode,
41 'error_data' => $errorData,
49 * Function returns array of result expected from previous function.
54 function activity_create_expectedresult() {
56 $expectedResult = array(
64 'source_record_id' => '',
65 'activity_type_id' => '51',
66 'subject' => 'test activity type id',
67 'activity_date_time' => '20110602143613',
69 'location' => 'Pennsylvania',
72 'details' => 'a test activity',
79 'relationship_id' => '',
80 'is_current_revision' => '',
85 'engagement_level' => '',
91 return $expectedResult;
95 * This example has been generated from the API test suite.
96 * The test that created it is called
97 * testActivityCreateCustomContactRefField
99 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
101 * You can see the outcome of the API tests at
102 * https://test.civicrm.org/job/CiviCRM-master-git/
104 * To Learn about the API read
105 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
107 * Browse the api on your own site with the api explorer
108 * http://MYSITE.ORG/path/to/civicrm/api/explorer
110 * Read more about testing here
111 * http://wiki.civicrm.org/confluence/display/CRM/Testing
113 * API Standards documentation:
114 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards