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
yaoyao 

webservice method returning object or array of objects

Hey,
 
I'm using, via a SoapCall, a webservice method that return an array of Objects.
 
Code:
webService static CObject__c[] getCObject(String id) {
  
  CObject__c[] c = [SELECT
     Id,
     Name,
     FROM HF_CObject__c];
       
  
  return c;
  
  
}

 
I'm using, in my php code the result method to retrieve my array of objects.
 
Code:
$parameters->id = $_GET[id];
$response = $soapClient->getCObject($parameters);
$result = $response->result;

 
Problem is when that query returns a single record, I don't get an array, but only an Object.
 
How can I solve that ?
 
Thx a lot,
 
Regards.
ozhereozhere

Hi,

 

I have the same problem. Were you able to solve it?

 

Thanks

-ozhere

ShikibuShikibu

I think you need this:

 

 


webService static CObject__c[] getCObject(String id) {

webService CObject__c[] c = [SELECT
Id,
Name,
FROM HF_CObject__c];


return c;


}