Salesforce Fact #676 | Get readonly fields in page layout using apex
Using Metadata class methods, we can get the list of fields present in a particular page layout. Suppose we need to find out the list of ReadOnly fields in a page layout, we can get the same using a condition check on Metadata.UiBehavior enum. It has three values: ' Edit ', ' ReadOnly ' & ' Required '. Reference: https://salesforce.stackexchange.com/questions/179442/apex-metadata-api-layout-read-only-fields-being-added-as-read-write Attached is the screenshot.