function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
palak agarwalpalak agarwal 

Retrieving fields of particular layout .

Hi all,

 

I am trying to fetch all the fields on contact,  which belong to a particular Layout, through apex code.  So far I am not able to find solution to this problem. Please , if anyone knows how to do it, reply. Its urgent.

 

with Regards

Palak agarwal

bvramkumarbvramkumar

I think you will have to use SF Meta Data Api.  Here it is...  http://www.salesforce.com/us/developer/docs/api_meta/index.htm

PalakPalak

Hi

 

Thanks for ur reply.

 

Could you please help me in the below listed questions:

1) Which specific object stores the layout information ?

2) I opened up the link and read about article type layout. I dint find any item which could give me data related to object fields.

3) I need to implement my code in apex and as far as i know metadata API is used for java codes. Is it correct ?

 

Any help would be appreciated.

 

Thanks

 

 

 

 

bvramkumarbvramkumar

Yes. Meta Api is usually consumed by lang. like Java, C#.net, Ruby etc. I am not sure if you could create proxy for the Meta Api web service in Apex and consume the service witihin the SF org.

 

I can not precisely tell you which object to use. But the Api is worth exploring. All the 3rd party IDEs use Meta Api to download all sorts of meta components from the SF Org. That is the reason why you can see "Layouts" folder while doing "Add/Remove Meta Data Components" in your Eclipse force.com IDE.

 

Basically the Meta Api downloads the requested Meta component in XML format. you will have to parse the xml to get the info. you need.