Which two ways can the developer retrieve the available fields if the variable myObject represents the name of the object?

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 two.)
A. Use myObject.sObjectType.getDescribe().fieldSet() to return a set of fields.
B. Use mySObject.myObject.fields.getMap() to return a map of fields.
C. Use Schema.describeSObjects(new String[]{myObject})[0].fields.getMap() to return a map of fields.
D. Use getGlobalDescribe().get(myObject).getDescribe().fields.getMap() to return a map of fields.

CRT-450: Salesforce Certified Platform Developer I

Free dumps for CRT-450 in PDF format.

High quality CRT-450 PDF and software. VALID exam to help you pass.

Download Printable PDF. VALID exam to help you PASS.

4 thoughts on “Which two ways can the developer retrieve the available fields if the variable myObject represents the name of the object?

  1. CD are correct ans

    Map map1 = Schema.describeSObjects(new String[]{‘Account’})[0].fields.getMap();
    System.debug(‘ Map 1 ‘+map1.Values());

    Map map2 = Schema.getGlobalDescribe().get(‘Account’).getDescribe().fields.getMap();
    System.debug(‘ Map 2 ‘+map2.Values());

  2. There is only one option is correct which is C
    However option D will be correct if it will be called like below:-
    Schema.getGlobalDescribe().get(myObject).getDescribe().fields.getMap()

    As we can see Schema. is missing in option D

  3. three ways to get fields:
    system.debug(Schema.getGlobalDescribe().get(‘Building__c’).getDescribe().fields.getMap());
    system.debug(Schema.describeSObjects(new String[]{‘Building__c’})[0].fields.getMap());

    system.debug(schema.SObjectType.Building__c.fields.getMap());
    mySObject.Building__c.fields.getMap();

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.