0

I am trying to create a pushtopic to listen to the CaseComment object. Typed the following in the ApexExec:

PushTopic pushTopic = new PushTopic();
pushTopic.Name = 'CaseCommentTopic';
pushTopic.Query = 'SELECT Id FROM CaseComment';
pushTopic.ApiVersion = 36.0;
pushTopic.NotifyForOperationCreate = true;
pushTopic.NotifyForOperationUpdate = true;
pushTopic.NotifyForOperationUndelete = true;
pushTopic.NotifyForOperationDelete = true;
pushTopic.NotifyForFields = 'Referenced';
insert pushTopic;*

I get the below error:

"System.DmlException: Insert failed. First exception on row 0; first error: INVALID_FIELD, 'CaseComment' is not supported: [Query]"*

Can someone please help me understand why this error occurs

1

This is just because its not supported, you can find reference here

The following are examples of supported SOQL statements.

  • Custom object

    SELECT Id, MyCustomField__c FROM MyCustomObject__c
    
  • Standard objects (may include custom fields)

    • Account

      SELECT Id, Name FROM Account WHERE NumberOfEmployees > 1000
      
    • Campaign

      SELECT Id, Name FROM Campaign WHERE Status = 'Planned'
      
    • Case

      SELECT Id, Subject FROM Case WHERE Status = 'Working' AND IsEscalated = TRUE
      
    • Contact

      SELECT Id, Name, Email FROM Contact;
      
    • Lead

      SELECT Id, Company FROM Lead WHERE Industry = 'Computer Services'
      
    • Opportunity

      SELECT Id, Name, Amount FROM Opportunity WHERE CloseDate < 2011-06-14
      
    • Task

      SELECT Id, Subject, IsClosed, Status FROM Task WHERE isClosed = TRUE
      

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.