+ Start a Discussion

sforce.SforceService.retrieve without the Id field


I have a massive list of Account Id's for which i'm trying to retrieve there related Assets'

Now this list is too big to create a SOQL query string.

I thought of using the sforce.SforceService.retrieve feature, but this only takes a list of Id;s and cannot be passed a list of AccountId's (a different field from the Id field)

HOw would i do this type of query?


Grant Merwitz
Workshare Ltd.


Hi GrantM,

Sounds like you should probably do this matching on the client.  This means pull down all the asset ids and their accountid ids and stick them in a Hashtable keyed on account id.

query("Select Id, AccountId from Asset");

You will need to do queryMore to get them all and if possible limiting by a date would be good.

hasht.Add(record.AccountId, record.id) would add the asset ids to the hashtable hasht.  You can now go through your massive list of account ids and pull the asset id.  What you want to do is collect up an array of asset ids for use in one or more (probably more) retrieve calls.

The other option is to break your ids into chunks and create large soql statements for query.


thanks for your advice

I had already done the latter method, where i build up an Array of SOQL queries
If the query gets to 1000 characters, i pop it into an array and start a new query

At the end, i loop through that a do a query for each.

Working for me, but its a pity the 'retrieve' feature cannot be passed which field to search by

Thanks again for your help