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
michael.vomichael.vo 

Dynamic datetime in streaming push topic

I need to get records between a specific time period in a push topic. For example all records between 6pm and 2am. 

Select Id from Opportunity where dateTime >= {Today's Date @ 6pm} and dateTime <= Tomorrow's Date @ 2am}

Is this possible?

I have one solution which is to just pull all today's and tomorrow's records and then filter on the client side by the right time.

http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_calls_soql_select_dateformats.htm

Anyone else have a solution to this?
Ashish_SFDCAshish_SFDC
Hi Michael,


There is no direct way to do this, 

You have to use a schedule apex class which will run at the mentioned time and have your Streaming API as a Inner class. 

https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm


Regards,
Ashish