2

I'm creating PushTopics for streaming api and have trouble creating one for OpportunityContactRole object.

Executing the following apex code in Developer Console Window

PushTopic pushTopic = new PushTopic();
pushTopic.Name = 'test';
pushTopic.Query = 'SELECT Id FROM OpportunityContactRole';
pushTopic.ApiVersion = 50.0;
pushTopic.NotifyForOperationCreate = true;
pushTopic.NotifyForOperationUpdate = true;
pushTopic.NotifyForOperationUndelete = true;
pushTopic.NotifyForOperationDelete = true;
pushTopic.NotifyForFields = 'Referenced';
insert pushTopic;

returns the following error

Line: 10, Column: 1 System.DmlException: Insert failed. First exception on row 0; first error: INVALID_FIELD, 'OpportunityContactRole' is not supported: [Query]

Similar code with another object (like Opportunity) works.

Is something different with OpportunityContactRole here?

0

According to documentation only custom objects and a subset of standard objects (see below) support PushTopic queries:

Account
Campaign
Case
Contact
ContractLineItem
Entitlement
Lead
LiveChatTranscript
Opportunity
Quote
QuoteLineItem
ServiceAppointment
ServiceContract
Task
WorkOrder
WorkOrderLineItem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.