You need to sign in to do that
Don't have an account?
Nadula
Retrieve all the data by object ID
Hi Guys,
Need some help here,
I want to retrieve all the field data of a particular object.
I see standard retrieve core call (http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_retrieve.htm" target="_blank) has three arguments (fieldList, sObjectType, ids).
How can I retrieve all the data in all the fields without passing in full field list?
Thanks in advance
Nadula
Need some help here,
I want to retrieve all the field data of a particular object.
I see standard retrieve core call (http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_retrieve.htm" target="_blank) has three arguments (fieldList, sObjectType, ids).
How can I retrieve all the data in all the fields without passing in full field list?
Thanks in advance
Nadula
See below code it will fetch all Fields from Account and then will fetch data from Account Object related to those fields.
All Answers
Is that mean I can't retreive data wihtout passsing in field names?
Is there any way I can pass some sort of wild card like "all" or something to the "retrieve" method to get all the field data returned?
Thanks
Nadula
Thanks for the info.
Well, since the object I'm querying has more than 100 fields, that means I have to pass in all the field names if I want all the data retrieved of a particular object ID?
Thanks
Nadula
See below code it will fetch all Fields from Account and then will fetch data from Account Object related to those fields.
It an awesome way to do it you pointed out.
I tried this, using a foreach to generate a string of fields returned by describeSObject(). It had 84 fields in total.
I passed that string to retrieve() and it only returned only 23 fileds of data.
Is there any limitation to the number of fields we can pass in to the function in one time?
Thanks
Nadula
Database.query('Select '+fieldApiName +' from ObjectName ') ;
fieldApiName -- > Comma separated field API name like id,Name,createdByid ...
ObjectName --> Your SObject API name like Account or MyCustomObj__c .
This will return you all field data which you will pass to it.
I'm coding the script using php.
Following is my code to get fields and construct a string to pass in to retrieve function. Any chance you can check it out?
$response = $mySforceConnection->describeSObject('Lead');
$allFields = array();
foreach($response->fields as $key => $value){
if(!empty($value->name)) $allFields[] = $value->name;
}
sort($allFields);
$allFieldString = "";
foreach($allFields as $field)
$allFieldString .= $field.", ";
$allFieldString = rtrim($allFieldString,", ");
$response1=$mySforceConnection->retrieve($allFieldString,"Lead",array("00Q9000000WP7LG"),"false");
And following is php script for "query" call:
This is my first Salesforce project.
Thanks heaps Deepak, much appreciated your help.
Cheers
Nadula