+ Start a Discussion
uzaironbitzeruzaironbitzer 

How to check if Account is no more accessible for user

Hi,

 

How can I use AccountShare object in salesforce API to check if an account is no longer accessible for a particular user?

 

For example, I have two users A and B and there's an account with AccountId = 000x0xxxx123    which is owned by user A. If I set organization wide sharing settings for Accounts to be Private and then change the ownership of this account to user B, then user A is not able to access it anymore. How can I check this using the API? Right now I'm using the following query but I receive a zero-length array:

 

SELECT AccountId, AccountAccessLevel, IsDeleted FROM AccountShare WHERE AccountId = '000x0xxxx123' AND  UserOrGroupId='000x000yx456'

Best Answer chosen by Admin (Salesforce Developers) 
skodisanaskodisana

Hi,

In the salesforce spring 12 release introduced a new table called UserRecordAccess table.

this will help you to find out whether user has access or not?

Below is link.

 

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_userrecordaccess.htm

 

Thanks,

Srikanth. K

 

All Answers

skodisanaskodisana

Hi,

In the salesforce spring 12 release introduced a new table called UserRecordAccess table.

this will help you to find out whether user has access or not?

Below is link.

 

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_userrecordaccess.htm

 

Thanks,

Srikanth. K

 

This was selected as the best answer
uzaironbitzeruzaironbitzer

Thanks Srikanth. That might be exactly what I'm trying look for. Can you plz indicate where can I download the API v24 cuz the force.com download page seems to provide just v20 for PHP.

uzaironbitzeruzaironbitzer

I mean I have downloaded Partner WSDL for v24 but its still giving me error:  INVALID_TYPE: sObject type 'UserRecordAccess' is not supported

skodisanaskodisana

Hi,

 

Currently this object is not exposed to any WSDls.

You can write a small webservice in salesforce by passing userid ,recordid and get response as true or false.

In the webservice method write a query by passing userid and recordidand retun true OR false.

Down load this wsdl and use it.

 

Thanks,

Srikanth. K