Created
June 8, 2018 14:07
-
-
Save ihavenoidea14/ff276b1a210d8a1c20a85bc9a0c4607b 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
| 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