3 * Test Generated example of using activity create API.
9 function activity_create_example() {
11 'source_contact_id' => 1,
12 'activity_type_id' => '51',
13 'subject' => 'test activity type id',
14 'activity_date_time' => '2011-06-02 14:36:13',
18 'location' => 'Pennsylvania',
19 'details' => 'a test activity',
20 'custom_1' => 'custom string',
24 $result = civicrm_api3('activity', 'create', $params);
26 catch (CiviCRM_API3_Exception
$e) {
28 $errorMessage = $e->getMessage();
29 $errorCode = $e->getErrorCode();
30 $errorData = $e->getExtraParams();
32 'error' => $errorMessage,
33 'error_code' => $errorCode,
34 'error_data' => $errorData,
42 * Function returns array of result expected from previous function.
47 function activity_create_expectedresult() {
49 $expectedResult = array(
57 'source_record_id' => '',
58 'activity_type_id' => '51',
59 'subject' => 'test activity type id',
60 'activity_date_time' => '20110602143613',
62 'location' => 'Pennsylvania',
65 'details' => 'a test activity',
72 'relationship_id' => '',
73 'is_current_revision' => '',
78 'engagement_level' => '',
84 return $expectedResult;
88 * This example has been generated from the API test suite.
89 * The test that created it is called
90 * testActivityCreateCustom
92 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
94 * You can see the outcome of the API tests at
95 * https://test.civicrm.org/job/CiviCRM-master-git/
97 * To Learn about the API read
98 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
100 * Browse the api on your own site with the api explorer
101 * http://MYSITE.ORG/path/to/civicrm/api
103 * Read more about testing here
104 * http://wiki.civicrm.org/confluence/display/CRM/Testing
106 * API Standards documentation:
107 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards