1

If we try to change the the owner of record and if new owner don't have access to the record from standard functionality we get "Before you can transfer this record, the new owner needs Read permission on it and related records."

How to we check in apex if user have access to the record type ..

i am checking if user have access  have access for that record in place of that i have to check if new owner have access to the record type . . as isAvailable() method check if logedin user have access for those record type . i know there is no direct way to check that. is there any workaround for that.

2 Answers 2

1

Check this Article:

This error may show up when an Opportunity record you own is transferred to another User. This may appear even if the User that is being specified as the new owner has read access to Accounts, Contacts or Opportunities.

You can try:

Depending on the Profile, or License used, you might check whether you can provide more access, maybe the Profile does not allow for access, but the license could, in which case you could add extra permissions to the Profile to broaden access.

A user with a Salesforce license, has the broadest permissions, if you would use a different license, a Community kind of license, a Force.com license type, or maybe a Chatter license type, access to objects might be different, and you might not all be able to give permission to the related objects.

2

You can us RecordTypeInfo class to determine which records types are available to a user.

Schema.DescribeSObjectResult R = Account.SObjectType.getDescribe();
List<Schema.RecordTypeInfo> RT = R.getRecordTypeInfos();
for (Schema.RecordTypeInfo RTI : RT) {
    if (RTI.isAvailable()){
        // they have access to this record type
    }
}

You must log in to answer this question.

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