Insert record with a different Owner
I am trying to add Calls to the CRM using the API 2.0 and PHP
I am retrieving call CDR records from our phone system, and I want to insert them into the Calls module, but with the 'Owner' being the relevent user.
I have tried the following:
-
$user = ZCRMOrganization::getInstance()->getUser($userId);
-
-
//Confirm we have the user object
-
print_r($user);
-
-
//Create empty call instance
-
$callInstance = ZCRMRecord::getInstance("Calls",null);
-
- //Other code in here
-
-
//Set the owner
$callInstance->setOwner($user);
This returns the error:
zohocrm\php-sdk\src\com\zoho\crm\library\api\handler\EntityAPIHandler.php:232
The same error is returned if I pass the ID as a string, or the e-mail address of the user.
I have also tried
- $callInstance->setFieldValue("Owner", $user);
Any ideas?
If I remove the owner section - it works fine, but creates the records as "me" - which is how I authenticated throught the API. My user is an Administrator.