3

Getting Unknown Exception while querying 'UserEntityAccess' in work bench,

Query :

SELECT
    EntityDefinition.Id,EntityDefinition.DurableId,
    EntityDefinition.QualifiedApiName, EntityDefinition.MasterLabel
FROM UserEntityAccess
WHERE UserId='xxxxxxxxU75'
AND EntityDefinition.qualifiedApiName= 'xx__c'

URL :

/services/data/v36.0/query?q=SELECT+EntityDefinition.Id,EntityDefinition.DurableId,EntityDefinition.QualifiedApiName,EntityDefinition.MasterLabel+FROM+UserEntityAccess+WHERE+UserId='xxxxxxxxxxU75'+and+EntityDefinition.qualifiedApiName=+'xx__c'

4
  • 1
    try to execute same query in developer console, doing so You will get the error code, and then contact salesforce support .
    – C0DEPirate
    Commented May 2, 2016 at 13:33
  • yes I am getting the errorID but am I doing the correct thing here? Commented May 2, 2016 at 13:37
  • definitely something is incorrect, since you are getting error id, I believe it is very difficult to tell whats wrong here
    – C0DEPirate
    Commented May 2, 2016 at 13:46
  • I reproduced it. Got back the GACK Error ID: 481405300-62604 (-1680970010) Do you have Premier support to raise it as a case? Commented May 3, 2016 at 0:01

1 Answer 1

2

I suspect you can't use EntityDefinition in the SOQL where clause like that against UserEntityAccess.

From the linked docs:

Field
EntityDefinition

Details - Description
The entity definition for the object associated with this user entity access record. Because this field represents a relationship, use only in subqueries.

5
  • Thanks @Daniel. I tried using DurableID field on the UserEntityAccess object itself instead of durableId on EntityDefinition. But I don't know why even that is not woking. Commented May 3, 2016 at 3:22
  • Can you please tell me how to query, what level of access a user has to a particular object, using either UserEntityAccess or any other object? And I saw durableId on UserEntityAccess is using some pattern like <i>APIName.entityDefinitionDurableID</i>. Do you know what is that pattern and how to query that. Commented May 3, 2016 at 3:27
  • @SaumyaRanjanSatapathy Typically you would check the level of access for an individual record id or a set of record ids. See Can I find out if the current user has access to a record without querying? Commented May 3, 2016 at 8:03
  • @SaumyaRanjanSatapathy You can also reverse how the query is down from v30.0 onwards. SELECT Id, Name, UserRecordAccess.HasReadAccess, UserRecordAccess.HasTransferAccess, UserRecordAccess.MaxAccessLevel FROM Account Commented May 3, 2016 at 8:06
  • Hi Daniel. To much surprise query in my question is running fine today, I don't know how. But thanks a lot for your help. And my requirement is like, a super user wants to see all the users and their access level to a perticular object. So I think using UserEntityAccess will only help me. Commented May 10, 2016 at 10:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .