function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
October Batch BgrOctober Batch Bgr 

Getting records Acess by users ..*****Urgent******

Hi folks ,

   My requirement is that i would like to know users acess on records ...Means weather he have read/create/Edit on which records and that records belonds which record type ..

Example
    I have 100 users with combination of  role and profile ...
am admin when  i login into one user  there is 10 objects   and each object have have 10 recordTypies  ,,and each Recor type have 1000+ records ..Now I would like to know which record he can edit ,create , or view ...so i need to capture that perticulor record Id..
  Could youum please please help out in task

How to achive this 

Thankful in advance
Regards
Naresh 
sandeep@Salesforcesandeep@Salesforce

Hi, 

Basically record accessibiity depends on many aspects like Object level permission, record type accessibility and thn sharing if any applied

Second way is you can go to developer console and execute query
[Select RecordID, HasreadAccess, HaseditAccess, HasdeleteAccess,HasTransferAccess ,HasAllAccess  From UserRecordAccess where  UserId = 'XXXXXXXX' AND RecordId In : ListofIDs]
here ListofIDs would be recordids you want to check in to.

for more detail pl visit on ths link 
http://www.codespokes.com/2014/06/salesforce-record-accessibility.html

Thanks
Sandeep Singhal
SRKSRK
To find out if a particular user has Edit access to a record, use the UserRecordAccess object. This object is available in API version 29.0 and later. You can use SOQL to query this object to find out if the user has edit access to the record in question.


SELECT RecordId FROM UserRecordAccess WHERE UserId=:UserInfo.getUserId() AND HasReadAccess = true AND RecordId IN :allRecordIds LIMIT 200

But make sure that allRecordIds is a LIST of IDs. It doesn't work if allRecordIds is a SET of IDs. I guess that's a bug.

Also, only a maximum amount of 200 recordIds can be checked in one query.


Refer the below mentioned link for more info on the same

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_userrecordaccess.htm