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
Thomas MonsonThomas Monson 

Streaming API Pushtopic creation error

Hi,

I am trying to create a pushtopic  in the developer console and I am getting an error Line: 5, Column: 1
Field is not writeable: PushTopic.NotifyForOperations

Here is my code

PushTopic pushTopic = new pushTopic();
pushTopic.Name ='RefreshAccounts';
pushTopic.Query='Select ID, Name FROM Account';
pushTopic.ApiVersion = 31.0;
pushTopic.NotifyForOperations ='edit';
pushTopic.NotifyForFields='Referenced';
    Insert pushTopic;
NagendraNagendra (Salesforce Developers) 
Hi Thomas,

Please try the below code:
PushTopic pushTopic = new pushTopic();
pushTopic.Name ='RefreshAccounts';
pushTopic.Query='Select ID, Name FROM Account';
pushTopic.ApiVersion = 31.0;
pushTopic.NotifyForOperationsEdit = true;
pushTopic.NotifyForFields='Referenced';
Insert pushTopic;
Hope this helps.

Please mark this as solved if it helps.

Best Regards,
Nagendra.P