diff --git a/docs/RecordTypes.html b/docs/RecordTypes.html index d695147..6748705 100644 --- a/docs/RecordTypes.html +++ b/docs/RecordTypes.html @@ -314,7 +314,7 @@

RecordTypes Methods

- Gives a map of all ACTIVE RecordTypeIds by developername for an sObject + Gives a map of all available (to the running user) RecordTypeIds by developername for an sObject
  • @@ -323,7 +323,7 @@

    RecordTypes Methods

    - Gives a map of all ACTIVE RecordTypeIds by name for an sObject + Gives a map of all available (to the running user) RecordTypeIds by name for an sObject
  • @@ -536,7 +536,7 @@

    - Gives a map of all ACTIVE RecordTypeIds by developername for an sObject + Gives a map of all available (to the running user) RecordTypeIds by developername for an sObject
    Signature @@ -572,7 +572,7 @@

    - Gives a map of all ACTIVE RecordTypeIds by name for an sObject + Gives a map of all available (to the running user) RecordTypeIds by name for an sObject
    Signature diff --git a/docs/assets/highlight.js b/docs/assets/highlight.js index 80185d3..4a64e8b 100644 --- a/docs/assets/highlight.js +++ b/docs/assets/highlight.js @@ -1227,7 +1227,7 @@ begin:[/\./,s.concat("(?:"+t+")"),/(?=\s*\([^\)])/],scope:{ begin:[/(?<=\s)/,s.concat("(?:"+t+")"),/(?=\s*\()/],scope:{2:"title.function"} }],contains:[r,o,e.APOS_STRING_MODE],relevance:0},u={ begin:/\[[\s\n]*(?=SELECT)/,end:/\]/,scope:"subst",relevance:10,contains:[{ -begin:s.concat(/\b/,s.either("ABOVE_OR_BELOW","ABOVE","ACTIVE","ADVANCED","ALL",/ALL\s+FIELDS/,"AND","ANY","ARRAY","AS","ASC","BY","CATEGORY","CONTAINS","COUNT","COUNT_DISTINCT","SUM","MAX","MIN","HOUR_IN_DAY","CONVERTCURRENCY","CUBE","DATA","DESC","DIVISION","END","EXCLUDES","FIELDS","FIND","FIRST","FOR","FROM",/GROUP\s+BY/,"HAVING","INCLUDES","LAST","LAST_90_DAYS","LAST_MONTH","LAST_N_DAYS","LAST_WEEK","LAST","LIKE","LIMIT","NETWORK","NEXT_90_DAYS","NEXT_MONTH","NEXT_N_DAYS","NEXT_WEEK","NULLS","OFFSET","ON","OR",/ORDER\s+BY/,"REFERENCE","RETURNING","ROLLUP","ROWS","SEARCH","SECURITY_ENFORCED","SELECT","SNIPPET","SORT","THIS_MONTH","THIS_WEEK","TODAY","TOLABEL","TOMORROW","TRACKING","TYPEOF","UPDATE",/USING\s+SCOPE/,"VIEW","VIEWSTAT","VIEWSTATE","WHERE","WITH","YESTERDAY","USER_MODE"),/\b/), +begin:s.concat(/\b/,s.either("ABOVE_OR_BELOW","ABOVE","available (to the running user)","ADVANCED","ALL",/ALL\s+FIELDS/,"AND","ANY","ARRAY","AS","ASC","BY","CATEGORY","CONTAINS","COUNT","COUNT_DISTINCT","SUM","MAX","MIN","HOUR_IN_DAY","CONVERTCURRENCY","CUBE","DATA","DESC","DIVISION","END","EXCLUDES","FIELDS","FIND","FIRST","FOR","FROM",/GROUP\s+BY/,"HAVING","INCLUDES","LAST","LAST_90_DAYS","LAST_MONTH","LAST_N_DAYS","LAST_WEEK","LAST","LIKE","LIMIT","NETWORK","NEXT_90_DAYS","NEXT_MONTH","NEXT_N_DAYS","NEXT_WEEK","NULLS","OFFSET","ON","OR",/ORDER\s+BY/,"REFERENCE","RETURNING","ROLLUP","ROWS","SEARCH","SECURITY_ENFORCED","SELECT","SNIPPET","SORT","THIS_MONTH","THIS_WEEK","TODAY","TOLABEL","TOMORROW","TRACKING","TYPEOF","UPDATE",/USING\s+SCOPE/,"VIEW","VIEWSTAT","VIEWSTATE","WHERE","WITH","YESTERDAY","USER_MODE"),/\b/), scope:"keyword"},{match:/(\bIN\b|<|<=|>|>=|\bNOT\s+IN\b|=|!\s*=|:{1})/, scope:"literal",relevance:0},{match:/(?<=\bFROM\b\s+)\w+/,scope:"type", relevance:0},{match:/\b[a-zA-Z][a-zA-Z_0-9]*\b/,scope:"property"},a,A], diff --git a/docs/assets/search-idx.js b/docs/assets/search-idx.js index 8e1f36e..bd240f3 100644 --- a/docs/assets/search-idx.js +++ b/docs/assets/search-idx.js @@ -7,7 +7,7 @@ export default [ { "title": "RecordTypes", "fileName": "RecordTypes.html", - "text": "RecordTypes This class is allows for easy, readable access to Record Type information from other classes. Written by Evan Callahan, copyright(c) 2010 Groundwire Updated by David Schach, copyright(c) 2021 This program is released under the GNU General Public License. http://www.gnu.org/licenses/ This class is meant to allow for access to Record Type information from within other classes. It is called statically, and therefore will supply the same information to all calls made from within one transaction, or set of trigger calls. This is beneficial because this info should be the same for all calls in a transaction, and by calling it statically we reduce the calls that are made, making the total transaction more efficient. Usage recommendation: Always use DeveloperName instead of Name, as this is more likely to be hard-coded in places, while the Name is actually a label and may change(especially due to user language). Signature global inherited sharing class RecordTypes See RecordTypesTest Author Evan Callahan , Groundwire Since 2010 Author David Schach , X-Squared on Demand Since 2021 Author Nicolas Vasquez, Globant Since 2022 RecordTypes Properties Name Signature Description gd private static Map gd Global schema describe recordTypeDevNamesById private static Map recordTypeDevNamesById Map of queried RecordType DeveloperName by Id recordTypeNamesById private static Map recordTypeNamesById Map of queried RecordType Name by Id recordTypesByDevName private static Map> recordTypesByDevName Map of Record Types by sObject name, then by DeveloperName recordTypesById private static Map> recordTypesById Map of Record Types by sObject name, then by Id recordTypesByName private static Map> recordTypesByName Map of Record Types by sObject name, then by Name recordTypesIdMap private static Map recordTypesIdMap Memoized map of queried RecordType records by Id recordTypesList private static List recordTypesList List of Record Type Info sObjects RecordTypes Methods clearMapsInTest() If we are running a test, clear sObject maps. We do this to avoid using @testVisible on the maps This is private and testvisible so it cannot be called in production code context fillMapsForObject(objectName) Gets record type maps for a new sObject We check in each public method if the sObject has already been described so we do not eagerly load DescribeSObjectResult getAvailableRecordTypeDevNameIdMap(sObjectName) Gives a map of all ACTIVE RecordTypeId s by developername for an sObject getAvailableRecordTypeNameIdMap(sObjectName) Gives a map of all ACTIVE RecordTypeId s by name for an sObject getRecordType(objectName, recordTypeId) Given an sObject and RecordType Id, return the RecordType object getRecordTypeDevNameFromId(objectName, recordTypeId) Given an sObject and RecordType Id, return the RecordType DeveloperName This saves a query on the RecordType object getRecordTypeDevNameFromId(recordTypeId) Generate map of all record type developer names by Id & return Record Type DeveloperName getRecordTypeDevNameFromName(objectName, recordTypeName) Given an sObject and RecordType Name, return the RecordType Id Note: Since RecordType.Name is not unique, this section could give unpredicable results If possible, DO NOT USE this method - use RecordType.DeveloperName methods instead getRecordTypeDevNameIdMap(objectName) Gives a map of all record type IDs by DeveloperName for an sObject getRecordTypeFromDevName(objectName, recordTypeDevName) Given an sObject and RecordType DeveloperName, return the RecordType Id getRecordTypeFromId(objectName, recordTypeId) Given an sObject and RecordType Id, return the Record Type object getRecordTypeFromName(objectName, recordTypeName) Given an sObject and RecordType Name, return the RecordType object Note: Since RecordType.Name is not unique, this section could give unpredicable results If possible, DO NOT USE this method - use RecordType.DeveloperName instead getRecordTypeIdFromDevName(objectName, recordTypeDevName) Given an sObject and RecordType DeveloperName, return the RecordType Id This should be the most-used method in this class getRecordTypeIdFromName(objectName, recordTypeName) Given an sObject and RecordType Name, return the RecordType Id Note: Since RecordType.Name is not unique, this section could give unpredicable results If possible, DO NOT USE this method - use RecordType.DeveloperName instead getRecordTypeIdSetFromDevNames(objectName, recordTypeDevNameSet) Gives a set of RecordType Ids from an sObject and a set of RecordType Developernames getRecordTypeNameFromDevName(objectName, recordTypeDevName) Given an sObject and RecordType DeveloperName, return the RecordType Name getRecordTypeNameFromId(objectName, recordTypeId) Given an sObject and RecordType Id, return the RecordType Name getRecordTypeNameFromId(recordTypeId) Generate map of all record type names by Id & return Record Type Name getRecordTypeNameIdMap(objectName) Gives a map of all RecordType IDs by name for an sObject getRecordTypesForSelectList(objectName) Make a Visualforce picklist with the RecordType Name displayed and the RecordType Id as the value getStringRecordTypesForSelectList(objectName) Make a Visualforce picklist with the RecordType Name displayed and the RecordType Name as the value clearMapsInTest() If we are running a test, clear sObject maps. We do this to avoid using @testVisible on the maps This is private and testvisible so it cannot be called in production code context Signature @testVisible private static void clearMapsInTest() fillMapsForObject(objectName) Gets record type maps for a new sObject We check in each public method if the sObject has already been described so we do not eagerly load DescribeSObjectResult Signature private static void fillMapsForObject(String objectName) Parameters objectName Type: String SObject name(with __c if custom, etc) Author David Schach getAvailableRecordTypeDevNameIdMap(sObjectName) Gives a map of all ACTIVE RecordTypeId s by developername for an sObject Signature global static Map getAvailableRecordTypeDevNameIdMap(String sObjectName) Parameters sObjectName Type: String SObject name(with __c if custom, etc) Returns Map Map Author Nicolas Vasquez getAvailableRecordTypeNameIdMap(sObjectName) Gives a map of all ACTIVE RecordTypeId s by name for an sObject Signature global static Map getAvailableRecordTypeNameIdMap(String sObjectName) Parameters sObjectName Type: String SObject name(with __c if custom, etc) Returns Map Map Author Nicolas Vasquez getRecordType(objectName, recordTypeId) Given an sObject and RecordType Id, return the RecordType object Signature global static Schema.RecordTypeInfo getRecordType(String objectName, Id recordTypeId) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeId Type: Id RecordType Id Returns Schema.RecordTypeInfo RecordTypeInfo object Author David Schach getRecordTypeDevNameFromId(objectName, recordTypeId) Given an sObject and RecordType Id, return the RecordType DeveloperName This saves a query on the RecordType object Signature global static String getRecordTypeDevNameFromId(String objectName, Id recordTypeId) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeId Type: Id RecordType Id Returns RecordType DeveloperName Author David Schach getRecordTypeDevNameFromId(recordTypeId) Generate map of all record type developer names by Id & return Record Type DeveloperName Signature global static String getRecordTypeDevNameFromId(Id recordTypeId) Parameters recordTypeId Type: Id RecordTypeId Returns String Record Type Name Author David Schach Since 2022-03-29 getRecordTypeDevNameFromName(objectName, recordTypeName) Given an sObject and RecordType Name, return the RecordType Id Note: Since RecordType.Name is not unique, this section could give unpredicable results If possible, DO NOT USE this method - use RecordType.DeveloperName methods instead Signature global static String getRecordTypeDevNameFromName(String objectName, String recordTypeName) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeName Type: String RecordType Name(can include spaces) Returns RecordType.DeveloperName Author David Schach Example RecordTypes.getRecordTypeDevNameFromName('Account','Person Account') getRecordTypeDevNameIdMap(objectName) Gives a map of all record type IDs by DeveloperName for an sObject Signature global static Map getRecordTypeDevNameIdMap(String objectName) Parameters objectName Type: String SObject name(with __c if custom, etc) Returns Map Map Author David Schach getRecordTypeFromDevName(objectName, recordTypeDevName) Given an sObject and RecordType DeveloperName, return the RecordType Id Signature global static Schema.RecordTypeInfo getRecordTypeFromDevName(String objectName, String recordTypeDevName) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeDevName Type: String RecordType.DeveloperName (cannot include spaces) Returns Schema.RecordTypeInfo RecordTypeInfo object Author David Schach Example RecordTypes.getRecordTypeFromDevName('Account','Person_Account') getRecordTypeFromId(objectName, recordTypeId) Given an sObject and RecordType Id, return the Record Type object Signature global static Schema.RecordTypeInfo getRecordTypeFromId(String objectName, Id recordTypeId) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeId Type: Id RecordType Id Returns Schema.RecordTypeInfo RecordTypeInfo object Author David Schach getRecordTypeFromName(objectName, recordTypeName) Given an sObject and RecordType Name, return the RecordType object Note: Since RecordType.Name is not unique, this section could give unpredicable results If possible, DO NOT USE this method - use RecordType.DeveloperName instead Signature global static Schema.RecordTypeInfo getRecordTypeFromName(String objectName, String recordTypeName) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeName Type: String RecordType Name(can include spaces) Returns Schema.RecordTypeInfo RecordTypeInfo object Author David Schach getRecordTypeIdFromDevName(objectName, recordTypeDevName) Given an sObject and RecordType DeveloperName, return the RecordType Id This should be the most-used method in this class Signature global static Id getRecordTypeIdFromDevName(String objectName, String recordTypeDevName) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeDevName Type: String RecordType.DeveloperName (cannot include spaces) Returns RecordType Id Author David Schach Example RecordTypes.getRecordTypeIdFromDevName('Account','Person_Account') getRecordTypeIdFromName(objectName, recordTypeName) Given an sObject and RecordType Name, return the RecordType Id Note: Since RecordType.Name is not unique, this section could give unpredicable results If possible, DO NOT USE this method - use RecordType.DeveloperName instead Signature global static Id getRecordTypeIdFromName(String objectName, String recordTypeName) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeName Type: String RecordType Name(can include spaces) Returns RecordType Id Author David Schach Example RecordTypes.getRecordTypeIdFromName('Account','Person Account') getRecordTypeIdSetFromDevNames(objectName, recordTypeDevNameSet) Gives a set of RecordType Ids from an sObject and a set of RecordType Developernames Signature global static Set getRecordTypeIdSetFromDevNames(String objectName, Set recordTypeDevNameSet) Parameters objectName Type: String Object of interest recordTypeDevNameSet Type: Set Set of DeveloperNames Returns Set All RecordType IDs for a given sObject Author David Schach Example Set rtNames = new Set {'Person_Account', 'Customer'}; getRecordTypeIdSetFromDevNames('Account', rtNames); getRecordTypeNameFromDevName(objectName, recordTypeDevName) Given an sObject and RecordType DeveloperName, return the RecordType Name Signature global static String getRecordTypeNameFromDevName(String objectName, String recordTypeDevName) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeDevName Type: String RecordType.DeveloperName (cannot include spaces) Returns RecordType Name Author David Schach Example RecordTypes.getRecordTypeNameFromDevName('Account','Person_Account') getRecordTypeNameFromId(objectName, recordTypeId) Given an sObject and RecordType Id, return the RecordType Name Signature global static String getRecordTypeNameFromId(String objectName, Id recordTypeId) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeId Type: Id RecordType Id Returns RecordType Name Author David Schach getRecordTypeNameFromId(recordTypeId) Generate map of all record type names by Id & return Record Type Name Signature global static String getRecordTypeNameFromId(Id recordTypeId) Parameters recordTypeId Type: Id RecordTypeId Returns String Record Type Name Author David Schach Since 2022-03-29 getRecordTypeNameIdMap(objectName) Gives a map of all RecordType IDs by name for an sObject Signature global static Map getRecordTypeNameIdMap(String objectName) Parameters objectName Type: String SObject name(with __c if custom, etc) Returns Map Map Author Evan Callahan getRecordTypesForSelectList(objectName) Make a Visualforce picklist with the RecordType Name displayed and the RecordType Id as the value Signature global static List getRecordTypesForSelectList(String objectName) Parameters objectName Type: String SObject name(with __c if custom, etc) Returns List Visualforce SelectOption list Author Evan Callahan getStringRecordTypesForSelectList(objectName) Make a Visualforce picklist with the RecordType Name displayed and the RecordType Name as the value Signature global static List getStringRecordTypesForSelectList(String objectName) Parameters objectName Type: String SObject name(with __c if custom, etc) Returns List Visualforce SelectOption list Author Evan Callahan" + "text": "RecordTypes This class is allows for easy, readable access to Record Type information from other classes. Written by Evan Callahan, copyright(c) 2010 Groundwire Updated by David Schach, copyright(c) 2021 This program is released under the GNU General Public License. http://www.gnu.org/licenses/ This class is meant to allow for access to Record Type information from within other classes. It is called statically, and therefore will supply the same information to all calls made from within one transaction, or set of trigger calls. This is beneficial because this info should be the same for all calls in a transaction, and by calling it statically we reduce the calls that are made, making the total transaction more efficient. Usage recommendation: Always use DeveloperName instead of Name, as this is more likely to be hard-coded in places, while the Name is actually a label and may change(especially due to user language). Signature global inherited sharing class RecordTypes See RecordTypesTest Author Evan Callahan , Groundwire Since 2010 Author David Schach , X-Squared on Demand Since 2021 Author Nicolas Vasquez, Globant Since 2022 RecordTypes Properties Name Signature Description gd private static Map gd Global schema describe recordTypeDevNamesById private static Map recordTypeDevNamesById Map of queried RecordType DeveloperName by Id recordTypeNamesById private static Map recordTypeNamesById Map of queried RecordType Name by Id recordTypesByDevName private static Map> recordTypesByDevName Map of Record Types by sObject name, then by DeveloperName recordTypesById private static Map> recordTypesById Map of Record Types by sObject name, then by Id recordTypesByName private static Map> recordTypesByName Map of Record Types by sObject name, then by Name recordTypesIdMap private static Map recordTypesIdMap Memoized map of queried RecordType records by Id recordTypesList private static List recordTypesList List of Record Type Info sObjects RecordTypes Methods clearMapsInTest() If we are running a test, clear sObject maps. We do this to avoid using @testVisible on the maps This is private and testvisible so it cannot be called in production code context fillMapsForObject(objectName) Gets record type maps for a new sObject We check in each public method if the sObject has already been described so we do not eagerly load DescribeSObjectResult getAvailableRecordTypeDevNameIdMap(sObjectName) Gives a map of all available(to the running user) RecordTypeId s by developername for an sObject getAvailableRecordTypeNameIdMap(sObjectName) Gives a map of all available(to the running user) RecordTypeId s by name for an sObject getRecordType(objectName, recordTypeId) Given an sObject and RecordType Id, return the RecordType object getRecordTypeDevNameFromId(objectName, recordTypeId) Given an sObject and RecordType Id, return the RecordType DeveloperName This saves a query on the RecordType object getRecordTypeDevNameFromId(recordTypeId) Generate map of all record type developer names by Id & return Record Type DeveloperName getRecordTypeDevNameFromName(objectName, recordTypeName) Given an sObject and RecordType Name, return the RecordType Id Note: Since RecordType.Name is not unique, this section could give unpredicable results If possible, DO NOT USE this method - use RecordType.DeveloperName methods instead getRecordTypeDevNameIdMap(objectName) Gives a map of all record type IDs by DeveloperName for an sObject getRecordTypeFromDevName(objectName, recordTypeDevName) Given an sObject and RecordType DeveloperName, return the RecordType Id getRecordTypeFromId(objectName, recordTypeId) Given an sObject and RecordType Id, return the Record Type object getRecordTypeFromName(objectName, recordTypeName) Given an sObject and RecordType Name, return the RecordType object Note: Since RecordType.Name is not unique, this section could give unpredicable results If possible, DO NOT USE this method - use RecordType.DeveloperName instead getRecordTypeIdFromDevName(objectName, recordTypeDevName) Given an sObject and RecordType DeveloperName, return the RecordType Id This should be the most-used method in this class getRecordTypeIdFromName(objectName, recordTypeName) Given an sObject and RecordType Name, return the RecordType Id Note: Since RecordType.Name is not unique, this section could give unpredicable results If possible, DO NOT USE this method - use RecordType.DeveloperName instead getRecordTypeIdSetFromDevNames(objectName, recordTypeDevNameSet) Gives a set of RecordType Ids from an sObject and a set of RecordType Developernames getRecordTypeNameFromDevName(objectName, recordTypeDevName) Given an sObject and RecordType DeveloperName, return the RecordType Name getRecordTypeNameFromId(objectName, recordTypeId) Given an sObject and RecordType Id, return the RecordType Name getRecordTypeNameFromId(recordTypeId) Generate map of all record type names by Id & return Record Type Name getRecordTypeNameIdMap(objectName) Gives a map of all RecordType IDs by name for an sObject getRecordTypesForSelectList(objectName) Make a Visualforce picklist with the RecordType Name displayed and the RecordType Id as the value getStringRecordTypesForSelectList(objectName) Make a Visualforce picklist with the RecordType Name displayed and the RecordType Name as the value clearMapsInTest() If we are running a test, clear sObject maps. We do this to avoid using @testVisible on the maps This is private and testvisible so it cannot be called in production code context Signature @testVisible private static void clearMapsInTest() fillMapsForObject(objectName) Gets record type maps for a new sObject We check in each public method if the sObject has already been described so we do not eagerly load DescribeSObjectResult Signature private static void fillMapsForObject(String objectName) Parameters objectName Type: String SObject name(with __c if custom, etc) Author David Schach getAvailableRecordTypeDevNameIdMap(sObjectName) Gives a map of all available(to the running user) RecordTypeId s by developername for an sObject Signature global static Map getAvailableRecordTypeDevNameIdMap(String sObjectName) Parameters sObjectName Type: String SObject name(with __c if custom, etc) Returns Map Map Author Nicolas Vasquez getAvailableRecordTypeNameIdMap(sObjectName) Gives a map of all available(to the running user) RecordTypeId s by name for an sObject Signature global static Map getAvailableRecordTypeNameIdMap(String sObjectName) Parameters sObjectName Type: String SObject name(with __c if custom, etc) Returns Map Map Author Nicolas Vasquez getRecordType(objectName, recordTypeId) Given an sObject and RecordType Id, return the RecordType object Signature global static Schema.RecordTypeInfo getRecordType(String objectName, Id recordTypeId) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeId Type: Id RecordType Id Returns Schema.RecordTypeInfo RecordTypeInfo object Author David Schach getRecordTypeDevNameFromId(objectName, recordTypeId) Given an sObject and RecordType Id, return the RecordType DeveloperName This saves a query on the RecordType object Signature global static String getRecordTypeDevNameFromId(String objectName, Id recordTypeId) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeId Type: Id RecordType Id Returns RecordType DeveloperName Author David Schach getRecordTypeDevNameFromId(recordTypeId) Generate map of all record type developer names by Id & return Record Type DeveloperName Signature global static String getRecordTypeDevNameFromId(Id recordTypeId) Parameters recordTypeId Type: Id RecordTypeId Returns String Record Type Name Author David Schach Since 2022-03-29 getRecordTypeDevNameFromName(objectName, recordTypeName) Given an sObject and RecordType Name, return the RecordType Id Note: Since RecordType.Name is not unique, this section could give unpredicable results If possible, DO NOT USE this method - use RecordType.DeveloperName methods instead Signature global static String getRecordTypeDevNameFromName(String objectName, String recordTypeName) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeName Type: String RecordType Name(can include spaces) Returns RecordType.DeveloperName Author David Schach Example RecordTypes.getRecordTypeDevNameFromName('Account','Person Account') getRecordTypeDevNameIdMap(objectName) Gives a map of all record type IDs by DeveloperName for an sObject Signature global static Map getRecordTypeDevNameIdMap(String objectName) Parameters objectName Type: String SObject name(with __c if custom, etc) Returns Map Map Author David Schach getRecordTypeFromDevName(objectName, recordTypeDevName) Given an sObject and RecordType DeveloperName, return the RecordType Id Signature global static Schema.RecordTypeInfo getRecordTypeFromDevName(String objectName, String recordTypeDevName) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeDevName Type: String RecordType.DeveloperName (cannot include spaces) Returns Schema.RecordTypeInfo RecordTypeInfo object Author David Schach Example RecordTypes.getRecordTypeFromDevName('Account','Person_Account') getRecordTypeFromId(objectName, recordTypeId) Given an sObject and RecordType Id, return the Record Type object Signature global static Schema.RecordTypeInfo getRecordTypeFromId(String objectName, Id recordTypeId) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeId Type: Id RecordType Id Returns Schema.RecordTypeInfo RecordTypeInfo object Author David Schach getRecordTypeFromName(objectName, recordTypeName) Given an sObject and RecordType Name, return the RecordType object Note: Since RecordType.Name is not unique, this section could give unpredicable results If possible, DO NOT USE this method - use RecordType.DeveloperName instead Signature global static Schema.RecordTypeInfo getRecordTypeFromName(String objectName, String recordTypeName) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeName Type: String RecordType Name(can include spaces) Returns Schema.RecordTypeInfo RecordTypeInfo object Author David Schach getRecordTypeIdFromDevName(objectName, recordTypeDevName) Given an sObject and RecordType DeveloperName, return the RecordType Id This should be the most-used method in this class Signature global static Id getRecordTypeIdFromDevName(String objectName, String recordTypeDevName) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeDevName Type: String RecordType.DeveloperName (cannot include spaces) Returns RecordType Id Author David Schach Example RecordTypes.getRecordTypeIdFromDevName('Account','Person_Account') getRecordTypeIdFromName(objectName, recordTypeName) Given an sObject and RecordType Name, return the RecordType Id Note: Since RecordType.Name is not unique, this section could give unpredicable results If possible, DO NOT USE this method - use RecordType.DeveloperName instead Signature global static Id getRecordTypeIdFromName(String objectName, String recordTypeName) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeName Type: String RecordType Name(can include spaces) Returns RecordType Id Author David Schach Example RecordTypes.getRecordTypeIdFromName('Account','Person Account') getRecordTypeIdSetFromDevNames(objectName, recordTypeDevNameSet) Gives a set of RecordType Ids from an sObject and a set of RecordType Developernames Signature global static Set getRecordTypeIdSetFromDevNames(String objectName, Set recordTypeDevNameSet) Parameters objectName Type: String Object of interest recordTypeDevNameSet Type: Set Set of DeveloperNames Returns Set All RecordType IDs for a given sObject Author David Schach Example Set rtNames = new Set {'Person_Account', 'Customer'}; getRecordTypeIdSetFromDevNames('Account', rtNames); getRecordTypeNameFromDevName(objectName, recordTypeDevName) Given an sObject and RecordType DeveloperName, return the RecordType Name Signature global static String getRecordTypeNameFromDevName(String objectName, String recordTypeDevName) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeDevName Type: String RecordType.DeveloperName (cannot include spaces) Returns RecordType Name Author David Schach Example RecordTypes.getRecordTypeNameFromDevName('Account','Person_Account') getRecordTypeNameFromId(objectName, recordTypeId) Given an sObject and RecordType Id, return the RecordType Name Signature global static String getRecordTypeNameFromId(String objectName, Id recordTypeId) Parameters objectName Type: String SObject name(with __c if custom, etc) recordTypeId Type: Id RecordType Id Returns RecordType Name Author David Schach getRecordTypeNameFromId(recordTypeId) Generate map of all record type names by Id & return Record Type Name Signature global static String getRecordTypeNameFromId(Id recordTypeId) Parameters recordTypeId Type: Id RecordTypeId Returns String Record Type Name Author David Schach Since 2022-03-29 getRecordTypeNameIdMap(objectName) Gives a map of all RecordType IDs by name for an sObject Signature global static Map getRecordTypeNameIdMap(String objectName) Parameters objectName Type: String SObject name(with __c if custom, etc) Returns Map Map Author Evan Callahan getRecordTypesForSelectList(objectName) Make a Visualforce picklist with the RecordType Name displayed and the RecordType Id as the value Signature global static List getRecordTypesForSelectList(String objectName) Parameters objectName Type: String SObject name(with __c if custom, etc) Returns List Visualforce SelectOption list Author Evan Callahan getStringRecordTypesForSelectList(objectName) Make a Visualforce picklist with the RecordType Name displayed and the RecordType Name as the value Signature global static List getStringRecordTypesForSelectList(String objectName) Parameters objectName Type: String SObject name(with __c if custom, etc) Returns List Visualforce SelectOption list Author Evan Callahan" }, { "title": "RecordTypesTest", diff --git a/force-app/main/default/classes/RecordTypes.cls b/force-app/main/default/classes/RecordTypes.cls index 41016dd..5c5f9c4 100644 --- a/force-app/main/default/classes/RecordTypes.cls +++ b/force-app/main/default/classes/RecordTypes.cls @@ -358,7 +358,7 @@ global inherited sharing class RecordTypes { } /** - * @description Gives a map of all ACTIVE `RecordTypeId`s by `developername` for an sObject + * @description Gives a map of all available (to the running user) `RecordTypeId`s by `developername` for an sObject * @author Nicolas Vasquez * @param sObjectName SObject name (with __c if custom, etc) * @return `Map` Map @@ -385,7 +385,7 @@ global inherited sharing class RecordTypes { } /** - * @description Gives a map of all ACTIVE `RecordTypeId`s by name for an sObject + * @description Gives a map of all available (to the running user) `RecordTypeId`s by name for an sObject * @author Nicolas Vasquez * @param sObjectName SObject name (with __c if custom, etc) * @return `Map` Map