You need to sign in to do that
Don't have an account?
Sanal
Ideal method for fetching lookup fields
Hi,
I have a lookup field (custom) in my custom object that is to be displayed using an S-Control. Since, on querying, I'm getting only the "Id" of the lookup field, I'm doing a "retrieve" call for fetching the original values. Is this the ideal way to do this?
This is taking significant time, since I'm having more lookup fields in my object.
Thanks in advance,
Sanal
Conceptually, yes (for now). With the V7 API you query, get the reference ID, then retrieve the values for that ID. If you have multiple references you issue multiple Retrieve calls.
(Obviously you could batch them if your initial call returned multiple records.)
For the Winter 07 release you will be able to use Join-like syntax and obviate the second retrieve call.
Luck, Steve.
Thank You Steve.
It seems like Winter 07 release has a lot of good things for developers like me.
- Sanal
Also you should be caching objects that are of the same type. In other words, it's common to have lookup fields for the same type and may have the same record referenced. Think of any object, you have ownerId, createdById and lastModifiedById, all of which are lookups to the user object. If the id is the same for all three fields you don't need to execute three retrieve calls as the first will suffice.
Also, remember, you can't mix types in the retrieve call. Each retrieve is for only a single type (although you can submit n Ids for that type).
Cheers
Message Edited by DevAngel on 11-28-2006 09:31 AM
Dave
Thank You Dave. I can surely use this for a better design.
Ron
I would love to attend Ron, and thanks for your invitation. I cant make it to the Seminar from India :smileysad:
- Sanal
Message Edited by Sanal on 11-30-2006 03:32 AM