I am unable to get the schema of the Lead object using:


this is returning null.

I did not have any problem while getting the schema of Account or Contact.

In my dev environment I DO got success to get the Lead schema, but no luck on the production environment.

Any advice?


  • Can you give some more context? Where are you trying to call this code? What API Version are you using?
    – Adrian Larson
    Oct 18, 2016 at 14:51

1 Answer 1


Can you try an see if the "lead" is coming in the debug or not to check?

Schema.SObjectType objType = Schema.getGlobalDescribe().get('Lead');
Map<String,Schema.SObjectType> objMap = Schema.getGlobalDescribe();
for(String str : objMap.keySet()) {
    System.debug(str + ' = '+ objMap.get(str));

Post the result from the above code.

  • I checked and the user has full administrative rights ("System Administrator"). And I can see that he has the permission for Lead as same as Contact or Account.
    – Talgo
    Oct 18, 2016 at 10:59
  • Permissions issues should not block you from seeing the schema.
    – Adrian Larson
    Oct 18, 2016 at 14:47
  • Also note that Schema.SObjectType.Lead yields exactly the same describe as Schema.getGlobalDescribe().get('Lead').
    – Adrian Larson
    Oct 18, 2016 at 14:49
  • Edited the answer. please try the code to check if the Describe is returning the Lead. Oct 18, 2016 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.