3 * Test Generated example of using activity Create API
4 * demonstrates create with Contact Reference Custom Field *
6 function activity_create_example(){
8 'source_contact_id' => 1,
9 'activity_type_id' => '49',
10 'subject' => 'test activity type id',
11 'activity_date_time' => '2011-06-02 14:36:13',
15 'location' => 'Pensulvania',
16 'details' => 'a test activity',
21 $result = civicrm_api3('activity', 'Create', $params);
23 catch (CiviCRM_API3_Exception
$e) {
25 $errorMessage = $e->getMessage();
26 $errorCode = $e->getErrorCode();
27 $errorData = $e->getExtraParams();
28 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
35 * Function returns array of result expected from previous function
37 function activity_create_expectedresult(){
39 $expectedResult = array(
47 'source_record_id' => '',
48 'activity_type_id' => '49',
49 'subject' => 'test activity type id',
50 'activity_date_time' => '20110602143613',
52 'location' => 'Pensulvania',
55 'details' => 'a test activity',
62 'relationship_id' => '',
63 'is_current_revision' => '',
68 'engagement_level' => '',
74 return $expectedResult;
79 * This example has been generated from the API test suite. The test that created it is called
81 * testActivityCreateCustomContactRefField and can be found in
82 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
84 * You can see the outcome of the API tests at
85 * https://test.civicrm.org/job/CiviCRM-master-git/
87 * To Learn about the API read
88 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
90 * Browse the api on your own site with the api explorer
91 * http://MYSITE.ORG/path/to/civicrm/api/explorer
93 * Read more about testing here
94 * http://wiki.civicrm.org/confluence/display/CRM/Testing
96 * API Standards documentation:
97 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards