I am trying to get Apex to describe the fields present on certain sObjects, everything I try works perfectly in the developer console but when I put the code into an Apex class and access it via a custom REST endpoint it works fine for the Lead object but stops working for the Task object.
I have tried several different ways of accessing this information:
Schema.getGlobalDescribe().get('Task').getDescribe().fields.getMap().values()
works in developer console while in the custom REST endpoint
Schema.getGlobalDescribe().get('Task')
returns null so it crashes
Task.sObjectType.getDescribe().fields.getMap().values()
works in developer console but returns an empty array in my custom REST endpoint, also I would really prefer if I could select the object dynamically which this approach does not allow.
((sObject)Type.forName('Task').newInstance()).getsObjectType().getDescribe().fields.getMap().values()
This one is a bit more roundabout but I was trying anything I could think of, but its results were identical to the previous one
Ive seen some similar posts with some proposed solutions but none of them seem to work for me, the API version of the class is 31.0 so I dont think the solution posted Schema.getGlobalDescribe returning different data from Developer Console is relevant
I also saw some stuff that made me think it might be related to the API restrictions of my managed package but I looked at the "API Access Privileges" for my package there is no option for the "Task" object so I dont know if im missing something or if that object is not API restricted or what.