sf_empty_recycle_bin {salesforcer} | R Documentation |
Empty Recycle Bin
Description
Delete records from the recycle bin immediately and permanently.
Usage
sf_empty_recycle_bin(ids, api_type = c("SOAP"), verbose = FALSE)
Arguments
ids |
|
api_type |
|
verbose |
|
Details
When emptying recycle bins, consider the following rules and guidelines:
The logged in user can delete any record that he or she can query in their Recycle Bin, or the recycle bins of any subordinates. If the logged in user has Modify All Data permission, he or she can query and delete records from any Recycle Bin in the organization.
Do not include the IDs of any records that will be cascade deleted, or an error will occur.
Once records are deleted using this call, they cannot be undeleted using
link{sf_undelete}
After records are deleted from the Recycle Bin using this call, they can be queried using the
queryall
argument for some time. Typically this time is 24 hours, but may be shorter or longer.
Value
tbl_df
of records with success indicator
References
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_emptyrecyclebin.htm
Examples
## Not run:
new_contact <- c(FirstName = "Test", LastName = "Contact")
new_records <- sf_create(new_contact, object_name = "Contact")
delete <- sf_delete(new_records$id[1],
AllOrNoneHeader = list(allOrNone = TRUE))
is_deleted <- sf_query(sprintf("SELECT Id, IsDeleted FROM Contact WHERE Id='%s'",
new_records$id[1]),
queryall = TRUE)
hard_deleted <- sf_empty_recycle_bin(new_records$id[1])
# confirm that the record really is gone (can't be deleted)
undelete <- sf_undelete(new_records$id[1])
# if you use queryall you still will find the record for ~24hrs
is_deleted <- sf_query(sprintf("SELECT Id, IsDeleted FROM Contact WHERE Id='%s'",
new_records$id[1]), queryall = TRUE)
# As of v48.0 (Spring 2020) you can query the Ids of all records in the Recycle
# Bin, which makes it easier to clear the entire bin because you can grab the
# Ids of the records first
records_in_bin <- sf_query("SELECT Record FROM DeleteEvent")
records_emptied_from_bin <- sf_delete(records_in_bin$Record)
## End(Not run)