I am trying to use the APEX method: .getType()
field metadata like so:
Schema.DescribeFieldResult campaignTypeFieldMeta = null;
Map<String,Schema.SObjectField> mapFields = Campaign.sObjectType.getDescribe().fields.getMap();
campaignTypeFieldMeta = mapFields.get('NS__CustomFieldName__c').getDescribe();
system.debug(campaignTypeFieldMeta);
String typeString = String.ValueOf(campaignTypeFieldMeta.getType())
This works normally in an unpackaged org, however, when I get into my packaging org, the debug statement says: "Entering Managed Package"
in the debug log. (This is my packaging org, not where the package is installed, so I don't know why I should be able to see my data own code execution!)
Furthermore, the last line in my code throws a 'Attempt to dereference a null object' exception.
String typeString = String.ValueOf(campaignTypeFieldMeta.getType()) // throws null exception in packaging org.
Is this something I'm misunderstanding about metadata describes?