Skip to content

Instantly share code, notes, and snippets.

@ihavenoidea14
Created June 8, 2018 14:07
Show Gist options
  • Save ihavenoidea14/ff276b1a210d8a1c20a85bc9a0c4607b to your computer and use it in GitHub Desktop.
Save ihavenoidea14/ff276b1a210d8a1c20a85bc9a0c4607b to your computer and use it in GitHub Desktop.
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
List<Schema.DescribeSObjectResult> standardObjDescs = new List<Schema.DescribeSObjectResult>();
for (Schema.SObjectType sobj : gd.values()) {
Schema.DescribeSObjectResult sobjDesc = sobj.getDescribe();
if (!sobjDesc.isCustom()) {
standardObjDescs.add(sobjDesc);
}
}
List<String> triggerableList = new List<String>();
List<String> NOTtriggerableList = new List<String>();
for (Schema.DescribeSObjectResult schemaDesc : standardObjDescs) {
String sobjStruct = JSON.serialize(schemaDesc);
DescribeSobjectResultJSON sobjProps = (DescribeSobjectResultJSON)JSON.deserialize(sobjStruct, DescribeSobjectResultJSON.class);
if (sobjProps.triggerable) {
triggerableList.add(sobjProps.name);
} else {
NOTtriggerableList.add(sobjProps.name);
}
}
NOTtriggerableList.sort();
for (String notTrigble : NOTtriggerableList) {
System.debug(notTrigble);
}
public class DescribeSobjectResultJSON {
public String name {get;set;}
public Boolean triggerable {get;set;}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment