+ Start a Discussion
DilluSalesForceDilluSalesForce 

How to List all sOBJECTS Dynamically

Hi,

    I am retriving ID based on Query String .Now i need to list all the sObjects dynamically based on that ID inorder to know to which sObject that Id belongs and retrive record from that sObject.I guess we can do this with SOSL Query but dont know how to proceed.Pls Provide me Query or any process to do this.

 

Pls do the needful.

AmphroAmphro

I can't narrow down a query unless I know how the sObjects are linked and how you are retrieving the ID. But I think you want something like this.

 

Id myId = mySObject.Id;
List myList = [select Name, MyObjectLookUp__c from SomeObject__c where MySObjectLookUp__c =: myId];
DilluSalesForceDilluSalesForce

Thanx for the reply

 

To be clear with my requirment i have an id, let us assume that id is some "XXXXXXXXXXX" and i dont know to which sObject  this ID belongs... so

 1)i need to retrive all the sobjects dynamically

2)compare this id with retrived objects inorder to know to which sObject the ID belongs.

3)based on comparision i need to retrive some records from that object.

 

this is my requirment.

 

Pls do the needful...

Edwin VijayEdwin Vijay

Iv heard something about the describeSobject method... I dont think you can call this from your apex class..

but since this is a webservice method i guess you can