You need to sign in to do that
Don't have an account?
sfdeveloper9
Record Types question
Is there a way in apex to know what record types the logged in user has access to on particular object?
Thanks.
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Is there a way in apex to know what record types the logged in user has access to on particular object?
Thanks.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_sobject_describe.htm#apex_recordTypeInfo_methods
This should help you. Check out method 'isAvailable'.
Regards,
Pankaj Raijade.
All Answers
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_sobject_describe.htm#apex_recordTypeInfo_methods
This should help you. Check out method 'isAvailable'.
Regards,
Pankaj Raijade.
Standard object and custom objects have a share object in which access level fields tells you which user can access the objects. First of all object_share object having three fields accesslevel, Userorgroupid and parentid. You can assign Userorgroupid with the logged-in user and parent id refer the id of object and access level takes a picklist values "edit", "Readonly" values. You have to DO a SOQL query on record type and bind the particular object with it. Tryout the code snippet given below :
RecordType RecTypeOrg = [Select Id, Name from RecordType where name ='Individual' limit 1];
Account accInd = [Select Id, Name,RecordTypeId from Account where RecordTypeId =:RecTypeOrg.id limit 1];
accountshare accshare = [select AccountAccessLevel,UserOrGroupId,AccountId from accountshare where UserOrGroupId =: userinfo.getuserid() and accountid=:accInd.id];
system.debug(' Access level ' + accshare.AccessLevel);
Note: In case of custom object, parentid field and access level field will work.