1

I have more then 25 record types with different page layout. Each page layout is having different fields added on page layout.

I have a vf page which is rendered as PDF. On this page I have to get all the fields on page layout and add on this page.

Can I get this fields dynamically depending on record type and display on VF page?

4
  • Hi Swapnil, Salesforce provides way to describe layouts by metadata api. Ref: developer.salesforce.com/docs/atlas.en-us.api.meta/api/…. But that is long way to go you need to study how fields are coming in tags of the described layout and then generate pdf dynamically. I would suggest you could go with field set. Admin can design fieldset and place fields in the same order the way page layout has been created. Jul 17, 2016 at 12:31
  • I can got with fieldset but problem is I am having different sections on the page like "Information", "Payment Details", "Assignment" etc. So, In field set I will not be able to add this sections dynamically. Jul 18, 2016 at 5:49
  • Dependent upon sections you could create multiple field sets and can use custom settting for defining sections and fieldset to be used. This is alternative solution since describing pagelayouts understanding it will take much more time. Jul 18, 2016 at 6:59
  • I am having 25 Page layouts and about 5 sections in it. So 25*5 = 125 Fieldsets. Don't we have another solution? Jul 18, 2016 at 8:43

1 Answer 1

0

Yes, You can do this. All you have to do is to pass record type and fetch meta data of the page layout and display those fields. You may need to make a web callout with in the Salesforce with administrator credentials in case you want this page on force.com site or community.

2
  • I want this page on click of button on the record. How will I get this details in apex and display fields on VF Page. Can you give a simple example. Jul 18, 2016 at 5:51
  • @SwapnilKael see Apex wrapper to metadata api
    – cropredy
    Jul 18, 2016 at 15:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .