0

I have a Custom object with many RecordTypes. A profile give just give access to one of the RT. and few permission sets which give access to different RT. Now in my class I want to fetch the recordtype access assigned to a User through profile and permission sets and based on that Write the logic of some functionalities.

Is there a way to fetch Record Type access for a specific object on a USER (including both Profile and Permission Sets).

Thanks in advance.

0

I did some search on this few days back, apparently there are no way to get the whole mapping list of User and RecordTypes. So you are left with only checking whether the current user has access to a specific Record Type or not.

    sObjectType objtype = Account.getsObjectType(); 
        List<RecordTypeInfo> infoList = objtype.getDescribe().getRecordTypeInfos();
        if(infoList.size()>1) //There will always be one default record type
        {
        for(RecordTypeInfo info:infoList)
        {
        if(i.isAvailable())
        {//Bang on, you have access to this RecordType, although the first one will 
//be the default one, so try to run this loop more than once to get custom
//Report Types}
        }
        }
    else //size is 1, which is default
    {//There is no Custom Report Type for this object}

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.