[SalesForce] Tooling api sObject type ‘ProfileLayout’ is not supported

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?

Best Answer

The describe call you're apparently looking for is:

/services/data/v43.0/sobjects/<ObjectName>/describe/layouts/<recordTypeId>

This will give you all the layout information need for a given record type and object type. This call is available for all users so long as they have any API access.

Related Topic