christiaan / zohocrmclient

Provides a clean readable PHP API to the Zoho Rest API
http://christiaan.github.io/zohocrmclient
MIT License
18 stars 14 forks source link

update not working because version 4 #11

Closed gekuhoko closed 7 years ago

gekuhoko commented 8 years ago

The updateRecord method will return with te following error

"4425 - Unable to process your request. Please check whether you have given the valid record Id".

The reason is that "version=4" is passed - which is according to docs (https://www.zoho.com/crm/help/api/updaterecords.html) only used for updating more than one record.

Not setting the version parameter in the updateRecords method solves the issue.

cristianpontes commented 8 years ago

You can change the request version number in ZohoCRMClient\Request\UpdateRecords.php in the configureRequest() method, but is not the best solution...

The best way to deal with the updates is passing the Id in the array record, like this:

$update = $client->updateRecords()
     ->addRecord(array(
         'Id'    => "1870824000000112001",
         'Field' => 'value'
         // ...
    ));
    ->request();

Regards

runemoennike commented 7 years ago

Passing the Id to each record is the correct answer here :)