3 * Test Generated example of using activity Create API.
5 * demonstrates create with Contact Reference Custom Field
10 function activity_create_example() {
12 'source_contact_id' => 1,
13 'activity_type_id' => '51',
14 'subject' => 'test activity type id',
15 'activity_date_time' => '2011-06-02 14:36:13',
19 'location' => 'Pennsylvania',
20 'details' => 'a test activity',
25 $result = civicrm_api3('activity', 'Create', $params);
27 catch (CiviCRM_API3_Exception
$e) {
29 $errorMessage = $e->getMessage();
30 $errorCode = $e->getErrorCode();
31 $errorData = $e->getExtraParams();
33 'error' => $errorMessage,
34 'error_code' => $errorCode,
35 'error_data' => $errorData,
43 * Function returns array of result expected from previous function.
48 function activity_create_expectedresult() {
50 $expectedResult = array(
58 'source_record_id' => '',
59 'activity_type_id' => '51',
60 'subject' => 'test activity type id',
61 'activity_date_time' => '20110602143613',
63 'location' => 'Pennsylvania',
66 'details' => 'a test activity',
73 'relationship_id' => '',
74 'is_current_revision' => '',
79 'engagement_level' => '',
85 return $expectedResult;
89 * This example has been generated from the API test suite.
90 * The test that created it is called
91 * testActivityCreateCustomContactRefField
93 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
95 * You can see the outcome of the API tests at
96 * https://test.civicrm.org/job/CiviCRM-master-git/
98 * To Learn about the API read
99 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
101 * Browse the api on your own site with the api explorer
102 * http://MYSITE.ORG/path/to/civicrm/api
104 * Read more about testing here
105 * http://wiki.civicrm.org/confluence/display/CRM/Testing
107 * API Standards documentation:
108 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards