3

Is it possible to consume record data (not just the record id) via the Streaming Api for a delete operation? The only thing that seems to come over is the recordId.

Here is an example of the pushTopic I have created:

PushTopic pushTopic = new PushTopic();
pushTopic.Name = 'testDelete';
pushTopic.Query = 'SELECT Id, data__c FROM test_object__c';
pushTopic.ApiVersion = 38.0;
pushTopic.NotifyForOperationDelete = true;
pushTopic.NotifyForOperationCreate = false;
pushTopic.NotifyForOperationUpdate = false;
pushTopic.NotifyForOperationUndelete = false;
pushTopic.NotifyForFields = 'All';
insert pushTopic;

Here is the output from Streaming Api:

{
    "clientId": "wsuskgmt6r9gj43i4e9buv9w9l",
    "data": {
        "event": {
            "createdDate": "2017-01-12T17:30:28.395Z",
            "replayId": 11,
            "type": "deleted"
        },
        "sobject": {
            "Id": "a37B0000000AQUuIAO"
        }
    },
    "channel": "/topic/testDelete"
}

As you can see, I only have the Id.

For my specific use case I am trying to migrate data from a lead when it is merged into another lead. Ideally, i could take the masterRecordId of the child record being deleted and use that to update the associated records to point to the new master. Since I am only given the record id from the child record, I need to make an extra query to get the masterRecordId. If I could get that information from the Streaming Api directly, that would be great.

1 Answer 1

1

You cannot. In fact, delete is not even mentioned when talking about the fields available for the notifications. https://developer.salesforce.com/docs/atlas.en-us.api_streaming.meta/api_streaming/notifyforfields_all.htm

I also tried to use an update notification with: pushTopic.Query = 'SELECT Id, data__c FROM test_object__c Where isDeleted = true ALL ROWS';

but ALL ROWS was not available in that context.

You must log in to answer this question.

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