function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PtitFredPtitFred 

Problem with retrieve call (php)

Hello, I always have this error when I use retrieve call :
org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.

This is my code :
$result = $client->retrieve("Id,OwnerId","Opportunity",$ids = array("00620000001*******","00620000001*******"),300);

It's work if I put just one Id in the third params instead of an array...

Somebody can help me please ? :]
Park Walker (TAGL)Park Walker (TAGL)

PtitFred wrote:
Hello, I always have this error when I use retrieve call :
org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.

This is my code :
$result = $client->retrieve("Id,OwnerId","Opportunity",$ids = array("00620000001*******","00620000001*******"),300);

It's work if I put just one Id in the third params instead of an array...

Somebody can help me please ? :]




Retrieve (and search) returns an array of result objects if there is more than one. Try something like this:

if ($result) {
$leads = $result->result;
if ($leads->size == 1) {
$recs = array($leads->records);
} else {
$recs = $leads->records;
}
return $recs;
}