Sample Code:
List < SelectOption > listRecTypes = new List < SelectOption >();
for ( RecordTypeInfo info: Opportunity.SObjectType.getDescribe().getRecordTypeInfos() ) {
if(info.isAvailable()) {
listRecTypes.add(new SelectOption(info.getRecordTypeId(), info.getName()));
}
}
The above code will add only the record type accessible to the user.
List < SelectOption > listRecTypes = new List < SelectOption >();
for ( RecordTypeInfo info: Opportunity.SObjectType.getDescribe().getRecordTypeInfos() ) {
if(info.isAvailable()) {
listRecTypes.add(new SelectOption(info.getRecordTypeId(), info.getName()));
}
}
The above code will add only the record type accessible to the user.
No comments:
Post a Comment