Get the Layout Corresponding To a Specific RecordType/Profile Combination – ‘Get Layout By Profile and Record Type’ Flow Action

Layouts often differ substantially from recordType to recordType and from profile to profile. This action takes a recordTypeId and a profileId and returns that combination’s current LayoutId. One use of this is dynamically generating flow screen layouts with the RecordDetail flow screen component. To do this, after using this action to retrieve a LayoutId, use the GetLayoutFields action to retrieve the list fo field names from that layout. You can then pass the list of field names to RecordDetail to generate a customized record detail right in your Flow screen that maps to the layout. To see this in action, check out this video.

Inputs

AttributeTypeDescription
recordTypeIdStringThe ID of a recordType
profileIdStringThe ID of a profile. Note that you can quickly generate this in Flow by creating a formula of $User.profileId

Outputs

AttributeTypeDescription
layoutIdString

Installation

Install this action as part of the QuickChoice managed package or just grab the source.

Subscribe
Notify of
guest
7 Comments
Inline Feedbacks
View all comments
Arvind

I am getting an error from this component when Profile Id and RecordTypeId is passed to the Apex Action: Error Occurred: An Apex error occurred: System.TypeException: Invalid conversion from runtime type List to Map

Robert Hansen

Were you ever able to resolve this issue, I am only getting in when I login as a non admin user.

[…] Get Layout Info by Record Type and Profile […]

David Rabizadeh

I am getting this error only when running the flow from a record. I do not get this error when debugging.
Error Occurred: An Apex error occurred: System.TypeException: Invalid conversion from runtime type List to Map

Adam White

Also getting the same errors as the folks be low – oddly it works when I am debugging it but doesnt when embedded on a Record Page.

Vijay K

The component functionality is working as expected, but in some scenarios like when adding OOB ‘set component visibility’ with component not visible trowing exceptions. The scenario like, hide the component with ‘set component visibility’ and continue next screen and come back previous screen and change the picklist value, The visibility not restting.

[…] displayed based on Record Type, take a look at the posts about Record Detail, Get Layout Fields and Get Layout By Record Type and Profile, and Get Record Type by […]