3 * Test Generated example demonstrating the Activity.create API.
8 function activity_create_example() {
10 'source_contact_id' => 1,
11 'activity_type_id' => '51',
12 'subject' => 'test activity type id',
13 'activity_date_time' => '2011-06-02 14:36:13',
17 'location' => 'Pennsylvania',
18 'details' => 'a test activity',
19 'custom_1' => 'custom string',
23 $result = civicrm_api3('Activity', 'create', $params);
25 catch (CiviCRM_API3_Exception
$e) {
27 $errorMessage = $e->getMessage();
28 $errorCode = $e->getErrorCode();
29 $errorData = $e->getExtraParams();
31 'error' => $errorMessage,
32 'error_code' => $errorCode,
33 'error_data' => $errorData,
41 * Function returns array of result expected from previous function.
46 function activity_create_expectedresult() {
48 $expectedResult = array(
56 'source_record_id' => '',
57 'activity_type_id' => '51',
58 'subject' => 'test activity type id',
59 'activity_date_time' => '20110602143613',
61 'location' => 'Pennsylvania',
64 'details' => 'a test activity',
71 'relationship_id' => '',
72 'is_current_revision' => '',
77 'engagement_level' => '',
83 return $expectedResult;
87 * This example has been generated from the API test suite.
88 * The test that created it is called "testActivityCreateCustom"
89 * and can be found at:
90 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
92 * You can see the outcome of the API tests at
93 * https://test.civicrm.org/job/CiviCRM-master-git/
95 * To Learn about the API read
96 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
98 * Browse the api on your own site with the api explorer
99 * http://MYSITE.ORG/path/to/civicrm/api
101 * Read more about testing here
102 * http://wiki.civicrm.org/confluence/display/CRM/Testing
104 * API Standards documentation:
105 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards