Hi, we are developing an app that connects a web page with Zoho CRM via API V2. Data is stored in a custom module. Oauth is working and we can retrieve records from the CRM but we can't send data. The code we are triying is the following:
<?php
require 'vendor/autoload.php';
ZCRMRestClient::initialize();
//Create a record instance to set fields.
$records = ZCRMRecord::getInstance("CustomModule8",null);
$records->setFieldValue("Email","test@test");
$records->setFieldValue("Especialidad","Arquitectura");
$records->setFieldValue("Name","Tonto");
$records->setFieldValue("Plan","Pro Mensual");
$records->setFieldValue("Tipo","Ecológica");
//Parse $records to an array.
$recordsArray = array($records);
//This the same code in the example that de documentations gives.
$zcrmModuleIns = ZCRMModule::getInstance("CustomModule8");
$bulkAPIResponse=$zcrmModuleIns->createRecords($recordsArray);
$entityResponses = $bulkAPIResponse->getEntityResponses();
foreach($entityResponses as $entityResponse)
{
if("success"==$entityResponse->getStatus())
{
echo "Status:".$entityResponse->getStatus();
echo "Message:".$entityResponse->getMessage();
echo "Code:".$entityResponse->getCode();
$createdRecordInstance=$entityResponse->getData();
echo "EntityID:".$createdRecordInstance->getEntityId();
echo "moduleAPIName:".$createdRecordInstance->getModuleAPIName();
}
}
?>
This code doesn't give error messages, but a warning:
Warning: count(): Parameter must be an array or an object that implements Countable in
C:\xampp\htdocs\vendor\zohocrm\php-sdk\src\com\zoho\crm\library\common\ZohoHTTPConnector.php on line
34
What's wrong with the code? How can the record instance be used to create/upsert/update records in a custom module?