I am trying to get pagelayout assigned to a user by querying ProfileLayout Object. I am running this query.
select Layout.FullName from ProfileLayout where ProfileId='xxxxxxxxxxx' and recordtypeId = 'yyyyyyyyy'
While going through documentation of ProfileLayout Object I found out that
only users with "View Setup and Configuration permission" can access this object.
But not all users will have this permission.
Another Issue is If Object doesn't have a recordtype then we need to use TableOrEnumId field to query
select Layout.FullName from ProfileLayout where ProfileId='xxxxxxxxxxx' and TableOrEnumId = 'yyyyyyyyy'
It is mentioned in document that we can use object api name for tableorenumid But api name Doesn't work for custom object and we need get objectId from CustomObject object again using tooling apiAPI. This API to get objecteId fails for non-admin users.
Is there any other way to get Pagelayouts assigned to user which should work for all the users.