3 * Test Generated example demonstrating the Activity.create API.
5 * Demonstrates setting & retrieving activity target & source.
10 function activity_create_example() {
12 'source_contact_id' => 1,
13 'subject' => 'Make-it-Happen Meeting',
14 'activity_date_time' => '20110316',
16 'location' => 'Pennsylvania',
17 'details' => 'a test activity',
19 'activity_type_id' => 1,
21 'target_contact_id' => 1,
22 'assignee_contact_id' => 1,
26 $result = civicrm_api3('Activity', 'create', $params);
28 catch (CiviCRM_API3_Exception
$e) {
30 $errorMessage = $e->getMessage();
31 $errorCode = $e->getErrorCode();
32 $errorData = $e->getExtraParams();
34 'error' => $errorMessage,
35 'error_code' => $errorCode,
36 'error_data' => $errorData,
44 * Function returns array of result expected from previous function.
49 function activity_create_expectedresult() {
51 $expectedResult = array(
59 'source_record_id' => '',
60 'activity_type_id' => '1',
61 'subject' => 'Make-it-Happen Meeting',
62 'activity_date_time' => '20110316000000',
64 'location' => 'Pennsylvania',
67 'details' => 'a test activity',
74 'relationship_id' => '',
75 'is_current_revision' => '',
80 'engagement_level' => '',
86 return $expectedResult;
90 * This example has been generated from the API test suite.
91 * The test that created it is called "testActivityReturnTargetAssignee"
92 * and can be found at:
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