I have a component that dynamically replicates a page layout . Im querying the ProfileLayout object to get the layout JSON, this works fine when i run as a sys admin, but fails when executed as a non-admin, getting this response:
{"message":"sObject type 'ProfileLayout' is not supported.","errorCode":"INVALID_TYPE"}
this is the query:
string query = 'select Layout.Name from ProfileLayout where ProfileId = \'' + UserInfo.getProfileId() + '\'';
Is there any way to achieve this?
Metadata
class? It supports layouts, but I am not sure if it will support your use case.