Created
August 14, 2020 04:04
-
-
Save victorabraham/5c45fbf1de246e113941a8331d02e8a5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public with sharing class RecordTypeUtil { | |
| //Do not use this | |
| public static Id getRecordTypeIdWithoutCache(String objectName, String recordtypeName) { | |
| Map<String, Schema.SObjectType> sObjectTypeMap = Schema.getGlobalDescribe(); | |
| Schema.SObjectType sotype = sObjectTypeMap.get(objectName); | |
| Map<String, Schema.RecordTypeInfo> recordTypeMap = sotype.getDescribe().getRecordTypeInfosByName(); | |
| return recordTypeMap.get(recordTypeName).getRecordTypeId(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment