Reply
Contributor
Sergiu LQD
Posts: 3
0
Accepted Solution

How to get full sObject base on ID.

Hello all,

I'm trying to find a way how I can get the full sObject from SF via API.
- using retrieve() you need to specify the filds which you need to be retrieved bu I will like to get them ALL.
- using search() ... there is no ID fields.

Can someone advice me pls how I can solve this issue?

THX in advance.

Contributor
mcintyrej
Posts: 4
0

Re: How to get full sObject base on ID.

[ Edited ]

Here is an example of how you can get all of the fields in an object and create a SOQL query.  (Sorry, the example is in Java).

 

https://gist.github.com/734428

 

You could create a query and pass the result into a sObject like so:

 

String SOQL = "select ...  from Account where ...";

 

QueryResult queryResult = sfdcBinding.query(SOQL);

               

if (queryResult.size > 0)

{

sObject[] Account = queryResult.records;

}

 

Hope this helps.

Contributor
Sergiu LQD
Posts: 3
0

Re: How to get full sObject base on ID.

THX a lot mcintyrej for your reply.
Your solution is interesting but is almost the same result as from retrieve(). You need to specify all fields, as * will not work in select.

 

Regards Sergiu.

 

Contributor
mcintyrej
Posts: 4
0

Re: How to get full sObject base on ID.

Hi,

 

If you review the link, it explains how to workaround the "*" problem.  It is not pretty but should work.

 

Regards,

John

Contributor
Sergiu LQD
Posts: 3
0

Re: How to get full sObject base on ID.

Ops... I didn't look at all at the link ...

THX a lot!!!!... my mistake.