Hi Guys,
Today we will use a snippet code that will get all the object's label names and their values (API) of Salesforce. These label names & values (API) will be standard as well as custom.
So let's try this code snippet in the "Anonymous Log of Developer Console".
1. Go to your developer console and press Ctrl+E from your keyboard to open "Anonymous Window".
2. Paste this code snippet and press the "Execute" button.
1 2 3 4 5 6 7 | List<selectoption> getAllObjects = new List<selectoption>(); for(SObjectType getValOfObj : Schema.getGlobalDescribe().values()) { getAllObjects.add(new SelectOption(String.valueOf(getValOfObj),getValOfObj.getDescribe().getLabel())); } system.debug('debugAllObj'+getAllObjects); |
3. Wait while the debug log does not open.
4. Check the "Debug Only" checkbox and see the debug. You will get the object's label & values (API).
5. To verify just go to the "Object Reference for Salesforce" and find here the Label name or values (API).
Thanks to all for reading this blog carefully.
No comments:
Post a Comment