function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Yogesh KumarYogesh Kumar 

sObject type 'Opportunity' is not supported.

Hi all

I'm executing this query from Java code using REST service:

SELECT Id, Name, StageName, Amount FROM Opportunity WHERE AccountId = 'xyz' AND OwnerId = 'abc'

I have System Administrator role, View All permission, Object level full permission on Opportunity object, all field level permissions on Opportunity fields.

Still i'm getting this error:

sObject type 'Opportunity' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.","errorCode":"INVALID_TYPE"

can you please suggest what i'm missing
Sanjay George 1Sanjay George 1
Hi Yogesh,

Can you check if you have 'API Enabled' at the profile level? If you are using the standarad 'System Administrator' profile, then this should be enabled by default.
Yogesh KumarYogesh Kumar
Hi Sanjay

yes i'm 'API Enabled' at the profile level. Still getting this error.
Yogesh KumarYogesh Kumar
Also, i'm abel to execute this query at Developer Console. But when i execute this query as REST service, i get this error:

"sObject type 'Opportunity' is not supported."
James LoghryJames Loghry
Check the user you're connecting to Salesforce with, and verify that their profile has access to read the Opportunity object.
Yogesh KumarYogesh Kumar
James,

yes, full access to read/edit Oppportunity object.
Yogesh KumarYogesh Kumar
Some more information:

same code is working in production but not in sanbox.

I have verified that user permissions/role are same in both production and sandbox.

what could be wrong with the sanbox?

thanks.
SARANG DESHPANDESARANG DESHPANDE
I am facing the same problem in Sandbox as well.
Udai KapilaUdai Kapila
Facing the same issue... has this been resolved for you?
Pavan WaghmodePavan Waghmode
I am also facing same problem. Any one found solution ?
 
Amogh AntarkarAmogh Antarkar

Facing the same issue: Making REST request from Java code fails with "message" : "sObject type 'LoginEvent' is not supported.", Developer console query when unchecked  box tooling api works.

Please update if anyone has figured out a solution to this.

 

Jeff Weller 3Jeff Weller 3

This issue is has happened on my team a few times.

The solution that works for us is unchecking the "Use Tooling API" checkbox next to the "Execute" button, within the "Query Editor" Tab.

Colin UllyottColin Ullyott
Any resolution on this? I am getting the same error when trying to access the OpportunitySpits object
Jeff Weller 3Jeff Weller 3
If you are using the Developer Console to test your query, make sure the "Use Tooling API" checkbox (to the right of the "Execute" button) is unchecked. If that checkbox is checked, you will get the error described above.
Colin UllyottColin Ullyott
Thanks Jeff for responding.  I have the "Use Tooling API" unchecked and am still getting the error. I also tested the 'Login Event' object from one of the responses above and got the same error, even though it ran in the dev console.  I have admin permissions and the objects are api enabled. I dont get it...
Manoj ThangavelManoj Thangavel
I am also facing the similar issue, but Profile(System Admin) has all access to the object, Any luck?