Skip to content

Instantly share code, notes, and snippets.

@HemantShukla
Created May 13, 2018 09:05
Show Gist options
  • Save HemantShukla/6c3ae992ea261079e764ef0567693dca to your computer and use it in GitHub Desktop.
Save HemantShukla/6c3ae992ea261079e764ef0567693dca to your computer and use it in GitHub Desktop.
PushTopic pushTopic = new PushTopic();
//Channel Name
pushTopic.Name = 'ProductUpdates';
//Define the query which will be used to create the payload
pushTopic.Query = 'SELECT Id, SKU__c, PackageType__c, ShelfLife__c FROM E_Product__c
pushTopic.ApiVersion = 42.0;
//Get Notification for all the fields
pushTopic.NotifyForFields = 'All';
/**** Optional, By Default all are true **/
pushTopic.NotifyForOperationCreate = true;
pushTopic.NotifyForOperationUpdate = true;
pushTopic.NotifyForOperationUndelete = true;
pushTopic.NotifyForOperationDelete = true;
insert pushTopic;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment