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
jacek2jacekjacek2jacek 

can i assign page layoout in apex code?

Hi.

can i assign page layoout in  apex code? I want to have one page layout if checkbox is set, and another page layout if checbkox is unset. Can page layout be assigned in trigger on checkbox?

thanks in advance for replies

Hengky IlawanHengky Ilawan

Hi,

 

You might want to consider using two record types, one for checked and another for unchecked checkbox. When the checkbox is checked, change the record type to for eg A, and when it is unchecked, change it to record type B (can be done by workflow)

Then you can assign different page layout for each record type.

 

Regards,

Hengky

jacek2jacekjacek2jacek

thanks, but we decisively  want to do it in apex (without record types) because of future business logic

Hengky IlawanHengky Ilawan

CMIIW, I think you need to use Visualforce page then.

 

Regards,

Hengky