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
Ian QuahIan Quah 

Getting source code for code generated by “Page Layouts”?

I'm interested in getting/viewing the source code generated by the building process as described in page layouts for custom objects. Does anyone know if it's possible?

I ask because I'd like to conditionally hide some of the fields, but building the entire process to look like it does would also be a lot of work so if possible I'd like to access the backend code and just modify that instead.

I have cross-posted this on StackOverflow but haven't gotten any responses so I'm not sure if what I'm hoping to do is possible
Alain CabonAlain Cabon

It is quite meaningless. You are not in the world of Open Source. Salesforce is only the proprietary world, secure, somewhere in the cloud.

1) "I'd like to conditionally hide some of the fields": this need has been solved for a long time using layouts according record types.

You will respond that you have a lot of combinations of fields. I know a case with dozens of standard layouts for the same object (different for each record type) used everyday in production.

The main problem with the record types is their selection in a transparent manner.

2) Another alternative would be the conversion of the page layout meta-data file from your IDE project for instance into a Visualforce Page with an apex controller for your customized needs.

Etherios EasyPage - Page Generator. Free Visualforce Page generator. Converts Page Layouts to Visualforce Pages

3) Finally, you have the validation rules (though all the fields remain visible).

Ian QuahIan Quah

1) can you elaborate on what you mean by "layouts according record types" ? I don't really understand what you mean. Are there links you could point me to that would further elaborate what you mean?

2) Do you know if this works for lightning as well? Or if it only supports visualforce pages3) 

Alain CabonAlain Cabon
1) If you add a record type to an object, you can create new standard different layout (point and click) for each value of the record type.

2) That works for lightning too.

Who Sees What: Record Types (Lightning Experience)​  18 jul. 2017

Creating a Record Type and Page Layout in