My query works on a full sandbox of my Org, but not on the Org itself, it give the error: INVALID_TYPE: sObject type 'My_Custom_Object__c' is not supported.
I am running the query under the system administrator credentials.
I have checked that these credentials have access to all the relevant objects. (In fact it has access to every single object.)
The objects are under a managed package, but there are no restrictions in place on the objects. (I have tried enabling restrictions and granting access to the necessary objects, but this has no effect.)
The custom objects are visible in the Visual Studio 'Object Browser', but if I return a DescribeGlobalResult object and echo out all the object names, the ones from within my managed packages are not visible.
Does any one have any idea why this does not work? And how can it be that it works in the full sandbox?
How to get sObject type from the Id?
I dont want to use the SOSL query approach or the exception handling approach. Is there any other straight forward way I can get the API name of the object if i pass the Id?
I attempted something like below
If(Account.sObjectType==new sObject (sId).getsObjectType())
expecting new sObject (sId).getsObjectType() to return Account.sObjectType if 'sId' belongs to an accoun record.
Please help and share your experience when you encountered similar situation.