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
cmarkiewiczcmarkiewicz 

retrieving deleted Contact

I want to retrieve a deleted Contact for replication purposes. I think I have the steps right - I call getDeleted(), I iterate through the result and build an array of the IDs, then I call retrieve using the ID array. But while my ID array contains the right IDs, my retrieve call returns nothing. Your documentation indicates that I should be able to do this (point 5 in the Replication section). Please let me know what I'm missing...
thanks
chris
benjasikbenjasik
The docs are incorrect, neither retrieve nor a soql call will return deleted records.

You'd need to already have the record replicated to your system.
darozdaroz


benjasik wrote:
The docs are incorrect, neither retrieve nor a soql call will return deleted records.

You'd need to already have the record replicated to your system.


Is there any hope of this changing in a future version?
benjasikbenjasik
Can you provide some more detail on your process and how you'd find this useful?

Since all of our APIs filter out deleted records today, we'd need to add a new call to retrieve deleted records to support this.
cmarkiewiczcmarkiewicz
in my case, i am synchronizing sf with another system. when i see that a record was deleted in sf, i want to mark it as deleted in the other system so that it is no longer a candidate for synchronization. originally i was only going to store the other system's keys in sf (as a custom field) - for use when synching. but since i can only get the deleted id and not the deleted object, i have to also store sf ids in the other system. so in my case it is not insurmountable - just less convenient.

thanks for the response
chris
darozdaroz

I can think of a few examples:

1. Integration where the destination system doesn't support the storage of the salesforce ID. This would save the need to store the IDs for both systems in the middleware. (Example: If an object is deleted that is part of an integration to an accounting package, for example, the accounting package would need to be updated accordingly.)

2. My client would like a daily report of objects deleted from the system. (His users aren't supposed to delete _anything_). In order to generate that report I have to duplicate the entire SF database. Also because getDeleted() (and getUpdated() more appropriately) has a granularity of 1 minute any changes made to the to-be-deleted records in it's last minute would be lost.

3. Flexability. If the feature can be implemented in a way that does not detract from any other feature how can it be bad?

As an aside, the ability to undelete something via tha API would be nice too.

(I'm sure there are others I can think of, but given that I haven't had my caffiene yet this morning and haven't crawled through my open task list yet today these are the ones at flot to the top of my mind...)

mustaphamustapha

Just to add my two-penneth - I was just trying to retrieve a deleted record so that my local storage reflected the state of the record at the time of deletion. Since my app polls salesforce every 10 minutes, any updates made within that time will be lost if the record is then deleted before an update occurs.

Is there any official reply as to whether the API is likely to be updated or not?

Regards, Ben

darozdaroz
I have a similiar problem with Leads...

I need to update some lead fields and can't do it if someone creates and quickly converts a lead... throws our reporting off too...
cmarkiewiczcmarkiewicz

fyi - i've not learned anything new on this.  i created a workaround for my particular problem. 

best of luck. 

chris.

benjasikbenjasik
converted leads are in the API.

Access to deleted records (and the recycle bin) are something on our roadmap. I don't have a timeline for you yet.