-
Notifications
You must be signed in to change notification settings - Fork 456
MetadataCatalogRecipes
Demonstrates how to query the Metadata Catalog. This is sometimes faster that Schema Describe calls especially for large complex orgs
Group Data Recipes
SUPPRESSWARNINGS
Demonstrates how to query the EntityDefinition Object to find all formula fields in your Org. This method returns a Map of Object's Qualified API name -> Map of Field Names -> Types Note: This method has a false-positive PMD warning. PMD isn't aware of the purpose or functionality of CanTheUser.* so it doesn't undersatnd that we are, in fact, checking for CRUD / FLS permissions prior to querying.
Type | Description |
---|---|
Map<String,Map<String,String>> |
Map<String, Map<String, String>> |
Map<String, Map<String, String>> results =
MetadataCatalogRecipes.findAllFormulaFields();
System.debug(results);
public static List<MetadataCatalogRecipes.LookupRelationshipDefinition> findAllContactFieldsThatLookupToAccount()
SUPPRESSWARNINGS
Demonstrates how to query the metadata catalog to find all fields on the Contact object that establish a relationship to the Account Object. Note: This method has a false-positive PMD warning. PMD isn't aware of the purpose or functionality of CanTheUser.* so it doesn't undersatnd that we are, in fact, checking for CRUD / FLS permissions prior to querying.
Type | Description |
---|---|
List<MetadataCatalogRecipes.LookupRelationshipDefinition> |
List<MetadataCatalogRecipes.LookupRelationshipDefinition> |
List<MetadataCatalogRecipes.LookupRelationshipDefinition> results =
MetadataCatalogRecipes.findAllContactFieldsThatLookupToAccount();
System.debug(results);
internal data object for information about a Lookup Relationship
Constructor that transforms a Field Definition object into a LookupRelationshipDefinition Object.
Param | Description |
---|---|
fd |
a FieldDefinition Object |
FieldDefinition fd = [SELECT Id, DeveloperName, RelationshipNme,
DataType
FROM FieldDefinition LIMIT 1];
MetadataCatalogRecipes.LookupRelationshipDefinition lrd = new
MetadataCatalogRecipes.LookupRelationshipDefinition(fd);
System.debug(lrd);
Specifies what object this one looks up to
Specifies the name of the Object
Specifies the Relationship field name
Specifies the Data Type Of this Object