I have overriden 'New' button on Account with an aura component. So when a user clicks on New button , all the Account record types get populated. The issue is, user has access to only 2 record types out of 6 record types, but still he can see all record types and can select either of the record type as soon as he clicks on New button. I have checked profile as well as permission sets for the user and user has only access to two record types.

Expectation: User should be able to see only two record types not all 6 record types.

 public with sharing class AccountSearchController {
public static List<String> fetchRecordTypeValues(){
    List<Schema.RecordTypeInfo> recordtypes = Account.SObjectType.getDescribe().getRecordTypeInfos();    
    recordtypemap = new Map<Id, String>();
    for(RecordTypeInfo rt : recordtypes){
        if(rt.getName() != 'Master')
        recordtypemap.put(rt.getRecordTypeId(), rt.getName());
    return recordtypemap.values();

//Method to fetch recordtype ID 
public static Id getRecTypeId(String recordTypeLabel){
    Id recid = Schema.SObjectType.Account.getRecordTypeInfosByName().get(recordTypeLabel).getRecordTypeId();        
    return recid;



I guess you need to check in apex class

Here is the code of apex where i check the record type of particular user

List<String> recordTypeNameList = new List<String>();
/** Need to create list to collect record type name.**/
Schema.DescribeSObjectResult R = Account.SObjectType.getDescribe();
/** You need to change the object name according to your requirement.**/
List<Schema.RecordTypeInfo> RT = R.getRecordTypeInfos();
for( Schema.RecordTypeInfo recordType : RT )
 /** Check if the recordtype is visible for the current user or not. **/
if(recordType.Name!='Master') {
 /** Collect the record type name in list. **/

Then after then i will call this apex method in aura and work accordingly .


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.