• Andrew Nguonly
  • NEWBIE
  • 0 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

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?

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?

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?