0

Question

For the current user, how do you programmatically retrieve the FlexiPage layout (i.e. fields) for the default Opportunity record type?

What I've Tried

Since, the FlexiPage layout potentially depends on the user's profile and the app (e.g. Sales), my current approach is to retrieve the app's ActionOverride and ProfileActionOverride lists.

High Level Steps

  1. Get current user's profile: SELECT FullName FROM Profile WHERE Id = '<profile_id>'
  2. Get all Opportunity FlexiPages: SELECT Id, DeveloperName FROM FlexiPage Where EntityDefinitionId = 'Opportunity'
  3. Get Sales app Metadata: SELECT Metadata FROM CustomApplication WHERE Label = 'Sales'
  4. Check Sales app ActionOverride list from Metadata and see if there is a FlexiPage associated with Opportunity.
  5. Check Sales app ProfileActionOverride list from Metadata and see if there is a FlexiPage associated with Opportunity and user's profile.
  6. Get Opportunity FlexiPage from ActionOverride or ProfileActionOverride and retrieve FlexiPage layout.

Issue

Sometimes, the Sales app Metadata contains an empty list for ActionOverride and ProfileActionOverride. In this scenario, how do you retrieve the FlexiPage layout (i.e. fields) for the default Opportunity record type?

3
  • so the lightning page is activated by app+profile but applies to all recordtypes? Do you have recordtypes defined on Opportunity?
    – cropredy
    Commented Jun 28, 2023 at 0:53
  • For some users, the Lightning page is assigned by app, profile, and record type. For other users, the Lightning page is NOT assigned by app, profile, or record type -- hence empty ActionOverride and ProfileActionOverride lists. There could be multiple record types defined for an Opportunity, but the default record type is used to retrieve the Lightning page layout. Commented Jun 28, 2023 at 1:52
  • Maybe the flexipage "layout" is derived at run time from the Layout metadataType that is assigned to the default record type
    – cropredy
    Commented Jun 28, 2023 at 16:14

0

You must log in to answer this question.