2

I have a vf page designed similar to a related list and am showing it inside an account detail page. The data for the vf comes from another custom object. The data in the custom object is created/updated/deleted from an external system using REST API.

Whenever data is updated, my streaming api passes the message to the vf page, and upon receiving any message, I am refreshing the panel inside my vf page using apex action function's rerender attribute.

When a record is created/updated, the panel inside vf gets refreshed and shows the latest information, but when there is a record deletion, I am unable to see a message being sent to vf page. So the record that is not present in the custom object still shows up until i manually refresh the page.

I read through the documentation and see that NotifyForOperations doesnt have delete value. Am i missing something here or is there a workaround?

Pushtopic configuration:

PushTopic pushTopic = new PushTopic();
pushTopic.Name = 'Test';
pushTopic.Query = 'SELECT Id, Gan__Document_Type__c FROM mycustomObject';
pushTopic.ApiVersion = 27.0;
pushTopic.NotifyForOperations = 'All';
pushTopic.NotifyForFields = 'All';
insert pushTopic;

4 Answers 4

3

Create a field called IsDeleted_c and update that to true, and list only the items for which IsDeleted_c not equals true and later you can schedule and bulk delete all the ones which has IsDeleted__c. This should work because Streaming API supports only Create and Update as mentioned in this page : http://www.salesforce.com/us/developer/docs/api/Content/pushtopic.htm under NotifyForOperations

3

Streamin API work only for that events ,Either the creation of a record or the update of a record. Each event may trigger a notification.

Please refer this link:- http://www.salesforce.com/us/developer/docs/api_streaming/ 1)Streaming Api Terms

1

I don't know too much about the Streaming API, but could you try changing your query to

pushTopic.Query = 'SELECT Id, Gan__Document_Type__c FROM mycustomObject ALL ROWS';

Then it will include the deleted row in the query and this might trigger the behaviour you are looking for.

1
  • I guess if this did work you would need to refer to the isDeleted field to determine if the update was a record delete.
    – Doug B
    Commented May 31, 2013 at 14:27
0

Just create a trigger on delete event and update a record by a value and reupdate with its privious value .

Account acc = [select Id,name from Account limit 1]; String name = acc.name;

acc.name ='xyz'; update acc; acc.name = name; update acc;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .