+ Start a Discussion
@ M  Coder@ M Coder 

Pagelayouts under a Recordtype

Hello Folks , 

Is there any soql query to retrieve all my Pagelayout Names under a recordtype in salesforce . 

or whats is the easiest way to find them . 

 
SwethaSwetha (Salesforce Developers) 
HI M Coder,
We cannot get layout associated with sObject through SOQL.There is also an idea for the same- https://trailblazer.salesforce.com/ideaView?id=08730000000KmowAAC
Please consider upvoting this idea so that salesforce product development team can implement it in coming releases based on number of upvotes.

As per, https://salesforce.stackexchange.com/questions/103209/soql-quey-to-get-page-layouts-names-for-perticular-object you might want to try the approach of using workbench.

Go to Info -> Metadata Types & Components and Select Layout from dropdown. You can see all layouts there per object
Related: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_describelayout_describelayoutresult.htm

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
Admin TrailAdmin Trail
Hi,

You can use the tooling API and get the layout name respected to Recordtypes. Eg.

Select LayoutName from ProfileLayout where RecordType.Name = 'Recordtype Name';

Hope this help you and you can retreive data as per your need.
@ M  Coder@ M Coder
Hi @Admin Trail , 

Thanks for your query , so let us say i have a recordtype named Consumer in opportunity object , how do you want me to write a quey reg opportunity object. 

My main aim is to see, which pagelayouts in Opportunity fall under Consumer recordtype.

Thanks in Adv


 
SwethaSwetha (Salesforce Developers) 
Thanks for the information, @Admin Trail

@MCoder,
This should help:
Select LayoutId,Layout.name,Recordtype.name from ProfileLayout where TableEnumOrId='Opportunity' and Recordtype.name='Consumer'

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you