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
Maggie LongshoreMaggie Longshore 

OpportunityContactRole Permissions to Query

As a System Admin I can run this query on our production org in the developer console Query tab..

Select Id,     
    opportunityId,
    contact.account.Name,
    contact.Id,
    contact.Name, 
    contact.FirstName,
    contact.LastName,
    contact.Phone,
    contact.Email,
    contact.LeadSource
    isPrimary,
    Role
from OpportunityContactRole
where opportunityId = '006xxxxxxxxx'

When I run the same query as System Admin in a sandbox I receive this error 'sObject type 'OpportunityContactRole' is not supported.'

I have compared access and permissions between teh orgs yet I can not figure out why.

I am able to create OpportunityContactRole in Apex code in both orgs yet I can't query from sandbox in apex to read the created object.
I need to get this to work so my unit tests will pass in both orgs.

 
Best Answer chosen by Maggie Longshore
PawanKumarPawanKumar
Please uncheck tooling API in developer console and try.
User-added image

All Answers

PawanKumarPawanKumar
Please uncheck tooling API in developer console and try.
User-added image
This was selected as the best answer
Maggie LongshoreMaggie Longshore
Thank you, I did not notice that it was checked, that fixed the query.