1

I'm trying to create a PushTopic on Event object using REST API with data

{
    "Name" : "EventTopic",
    "Query" : "SELECT Id,Subject,Location,StartDateTime,EndDateTime,IsDeleted,IsAllDayEvent FROM Event",
    "ApiVersion" : 41.0,
    "NotifyForOperationCreate" : true,
    "NotifyForOperationUpdate" : true,
    "NotifyForOperationUndelete" : true,
    "NotifyForOperationDelete" : true,
    "NotifyForFields" : "Referenced"
}

But the response says, its not supported, with HTTP/1.1 400 Bad Request

[ {
  "message" : "'Event' is not supported",
  "errorCode" : "INVALID_FIELD",
  "fields" : [ "Query" ]
} ]

Is there a workaround to this?

3

Unfortunately Event object is not supported by Streaming API.

Based on the context you can do following-

  1. For Visualforce, You can use apex:actionPoller.

  2. Outside Salesforce:

    • Manage a shadow custom object via Apex trigger [Disadvantage: extra object and trigger].
    • Poll the records in some interval [Disadvantage: would not be real time].

You can vote the idea here- Support Event object in PushTopic queries, after having enough votes maybe Salesforce will add it someday (remember Safe harbour statement).


Quoting From trailhead module - Use Streaming API:

Supported Objects in PushTopic Queries

PushTopic queries support all custom objects. PushTopic queries support the following standard objects.

  • Account
  • Campaign
  • Case
  • Contact
  • Lead
  • Opportunity
  • Task
  • How can I poll for the Events, looks like there's no list Url for events, So I can't get the IDs. CAn you point me to a resource using polling for events? – Manoj Jan 22 '18 at 11:52
  • Sorry that option was wrong, I didn't think enough. only option would be having a shadow object. – Raul Jan 22 '18 at 11:56

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.