• Nir Keren 14
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi All,

String SobjectApiName = 'Lead';
 Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
 Map<String, Schema.SObjectField> fieldMap = schemaMap.get(SobjectApiName).getDescribe().fields.getMap();
system.debug('***' + fieldMap);

following code works great on dev but when i put it in managed package its returning NULL, i am running the package as Admin and i have permissions to view/read/write 'Lead' .
more wierd is that its working for 'Account'

Please HELP.
 
Managed package question!
I have a simple code that works outside the managed package (MP), but when I put it inside the MP it just gives me the objects within the package, and not all of the org's objects:
Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
                    Map<string, string> sObjectNameToLabel = new Map<string, string> ();
                    
                    for(Schema.SObjectType d : schemaMap.values())
                    {
                        Schema.DescribeSObjectResult ds = d.getDescribe();
                        sObjectNameToLabel.put(ds.getName(),ds.getLabel());
                    }
Any ideas?