Skip to content

Instantly share code, notes, and snippets.

@emoran
Created December 12, 2014 01:11
Show Gist options
  • Save emoran/8150bc3c8ef620dc9eb0 to your computer and use it in GitHub Desktop.
Save emoran/8150bc3c8ef620dc9eb0 to your computer and use it in GitHub Desktop.
Get the default user profile
//find all Opportunity record types
List<Schema.RecordTypeInfo> infos = Schema.SObjectType.Event.RecordTypeInfos;
Id defaultRecordTypeId;
//check each one
for (Schema.RecordTypeInfo info : infos) {
if (info.DefaultRecordTypeMapping) {
defaultRecordTypeId = info.RecordTypeId;
}
}
recordTypeId = defaultRecordTypeId;
//here is the default Opportunity RecordType Id for the current user
System.debug(defaultRecordTypeId);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment