Skip to main content
Notice removed Draw attention by CommunityBot
Bounty Ended with no winning answer by CommunityBot
added 53 characters in body
Source Link
Manjot Singh
  • 3.6k
  • 23
  • 44

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 enter image description here

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.

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 enter image description here

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 api.

Is there any other way to get Pagelayouts assigned to user which should work for all the users.

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 enter image description here

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 API. 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.

Notice added Draw attention by Manjot Singh
Bounty Started worth 50 reputation by Manjot Singh
Source Link
Manjot Singh
  • 3.6k
  • 23
  • 44

How to get pagelayout assigned to a non admin users in apex

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 enter image description here

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 api.

Is there any other way to get Pagelayouts assigned to user which should work for all the users.