6

I am using the query editor. Consider the following query:

SELECT RecordId, HasDeleteAccess FROM UserRecordAccess
WHERE UserId = '005J0000006QnWhIAK'
AND RecordId IN ('00UJ000000AZUulMAH','00UJ000000AZUvRMAX')

When using multiple record ids the query returns wrong results:

00UJ000000AZUulMAH, HasDeleteAccess, false
00UJ000000AZUvRMAX, HasDeleteAccess, false

If I run the same query run with one recordId at a time (even while still using the IN operator) it returns true for both records.

  • Just try to do like this SELECT RecordId, HasDeleteAccess FROM UserRecordAccess WHERE RecordId IN ('00UJ000000AZUulMAH','00UJ000000AZUvRMAX') AND UserId = '005J0000006QnWhIAK' – Pavan tej Oct 9 '17 at 14:02
  • 1
    Apart from inverting the 2 WHERE params, what difference should it make? Anyway I had already tried without success. – shillem Oct 9 '17 at 14:03
  • 1
    Yeah I can reproduce this behavior. Looks like a bug. There doesn't yet appear to be a Known Issue for it. You should log a case. – Adrian Larson Oct 9 '17 at 16:49
  • I have run into this issue as well, really hope somebody comes up with a solution! – sv-alex Jan 19 '18 at 16:58
0

I had the same issue recently. All the code examples I found on Internet were using the method that was valid before API version 30.

In the documentation I've found a new way of receiving info about UserRecordAccess: https://developer.salesforce.com/docs/atlas.en-us.212.0.object_reference.meta/object_reference/sforce_api_objects_userrecordaccess.htm

Following the Docs your code should call this query:

SELECT Id, UserRecordAccess.HasDeleteAccess 
FROM YourObjectName__c
WHERE Id IN ('00UJ000000AZUulMAH','00UJ000000AZUvRMAX')
| improve this answer | |
  • Nice observation. Unfortunately the query doesn't work with all objects. I needed to execute it on Event ids but Event is not contemplated. – shillem Apr 4 '18 at 12:52

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.