+ Start a Discussion
Manish Kumar 61Manish Kumar 61 

Query to read soup data for custom object in Android app

I am looking for some examples for Android app of how can I write a query to retrieve data from a custom object soup that I created. Is it diferent than standard object soup structure

Can anyone give some sample code/ examples?
Best Answer chosen by Manish Kumar 61
Gaurav KheterpalGaurav Kheterpal
The querying process is the same for standard objects and custom objects. For example, if you do this for opportunity
 
return query("SELECT {Opportunity:Name}, {Opportunity:Id}, {Opportunity:AccountId}, {Opportunity:OwnerId}, {Opportunity:Amount} FROM {Opportunity}");
Similarly for a custom object, you would do something like
 
return query("SELECT {MyObj:Name}, {MyObj:Id}, {MyObj:Field1}, {MyObj:Field2} FROM {MyObj}");
That should work.

If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others and improve the overall quality of Discussion Forums.

Gaurav Kheterpal
Certified Force.com Developer| Salesforce Mobile Evangelist| Developer Forums Moderator| Dreamforce Speaker