I tried this query recently

SELECT Id, Name FROM AppMenuItem WHERE Id IN (SELECT SetupEntityId From SetupEntityAccess WHERE Parent.ProfileId =: id) ORDER BY Label

and got this error

The selected field 'SetupEntityId' in the subquery and the left operand field in the where expression in the outer query 'Id' should point to the same object type

I'm trying to do this for a profile such as the id would be the passed in id of the profile


When you compare the ID against the subselect on SetupEntityAccess, you're comparing agains the IDs of SetupEntityAccess, not the SetupEntityId values.

You can't accomplish what you want in a single SQL statement. You need to retrieve the SetupEntityAccess records, extract the SetupEntityId values, then perform another SQL query on the AppMenuItem using the set of SetupEntityId you've extracted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.