In my drupal custom module I am creating a case object via
$result = civicrm_api3('case', 'create', $params);
This function on debugging api.php file is returning the case id but in my module it is returning the null value
I want it to return the case id. How would i do so? Here code Snippet
function form_test_form_submit($form, &$form_state) $params = array( 'subject' => 'Test case', 'contact_id' => 64771, 'case_type' => 'test', ); $case = testcase_create($params); function testcase_create($params){ civicrm_initialize(); require_once 'api/api.php'; try{ $result = civicrm_api3('case', 'create', $params); } catch (CiviCRM_API3_Exception $e) { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); } return $result; // the value of $result is NULL, where as in api.php it was not NULL as seen in debugging }