function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
subbu naraharisettysubbu naraharisetty 

⦁ A developer needs to display all of the available fields for an object. In which two ways can the developer retrieve the available fields if the variable myObject represents the name of the object? Choose 2 answers

NitishNitish
You can use Schema.DescribesObjectResult
Schema.DescribeSObjectResult descAccount = Account.sObjectType.getDescribe(); 

Map<String, Schema.SObjectField> accFields = descAccount.fields.getMap();

for(Schema.sObjectField fld:accFields.values()){ 
               system.debug(fld);
}
subbu naraharisettysubbu naraharisetty
tqqq ... nitish
can u  give me one more answer
NitishNitish
Hi Subbu,
Second option is to use SOQL to get all the fields related to perticular object
SELECT Field FROM FieldPermissions WHERE SobjectType = 'Account'

Thanks,
Nitish