3

I'm trying to delete a flow version and I'm getting below error

This flow version is referenced elsewhere in salesforce.com. Remove the usage and try again. Flow Interview

and when trying to access the reference I get below error

Record deleted
The record you attempted to access has been deleted. The user who deleted this record may be able to recover it from the Recycle Bin. Deleted data is stored in the Recycle Bin for 15 days.

Some things I have tried:

  1. Recycle bin it's empty
  2. My org does not have any Paused/Waiting Flow Interviews
  3. Tried to delete the flow version with destructiveChanges.xml but received the same error
  4. Tried to re-deploy the flow through visual studio code with SFDX but still getting the same error when trying to delete the old version
  5. Creating a new version of the flow, I'm able to delete new versions but still not able to remove the old ones that throws the error

Any other ideas of of how to delete the versions throwing the error?

Thanks!

6
  • Can you check unexecuted scheduled actions ? (help.salesforce.com/…)
    – Vinay
    Commented Mar 23, 2021 at 13:43
  • Hello @Vinay, thanks for your answer, as I mentioned in my post I don't have any Paused/Waiting Flow Interviews. The error seems to indicate that there were paused/pending Flow Interviews that were deleted but I don't have anything on my Org's recycle bin Commented Mar 23, 2021 at 14:59
  • Deactivate flow(All versions) and try to delete old version.
    – Vinay
    Commented Mar 23, 2021 at 17:38
  • @Vinay I also tried to do that as well but still seeing same error. I had like 30 versions under that flow. I was able to delete all versions except for Ver-23 and Ver-26, both with the same error. I'm starting to think that this is something related to Salesforce Commented Mar 23, 2021 at 17:59
  • Found KI for similar issue (trailblazer.salesforce.com/issues_view?id=a1p4V0000003ySkQAI) which is fixed. Request you to log a case with salesforce
    – Vinay
    Commented Mar 23, 2021 at 20:15

3 Answers 3

4

I ran into this issue, although I had no paused flow intervals. Salesforce has saved failed flow interviews which would not let me delete my flow. Solved by navigating to Setup -->Paused and Failed Flow Interviews and deleting the appropriate records.

3

No matter if you have hundreds of these errors in one or more flows, if you do the following steps you can get rid of all your unwanted flows in 3 minutes or less.

  1. Login to https://workbench.developerforce.com/
  2. Under the "queries" menu, choose SOQL Query
  3. Paste this query after the arrow in the query box ---> SELECT Id,InterviewStatus FROM FlowInterview WHERE InterviewStatus = 'Error'
  4. Also choose the "Bulk CSV" option
  5. Click the query button
  6. A .csv should have downloaded to your computer
  7. Goto the Data menu and choose "Delete"
  8. Select the "From File" bullet and choose the .csv from #6
  9. Click the Next button
  10. Ensure that the id field is in both columns (Field and CSV field)
  11. Click the Map Fields button
  12. Choose either delete option, whichever applies
  13. Verify that ObjectType should be "FlowInterview"
  14. Click the Confirm Delete button

You now can delete all your flows that were stuck with the error "Can't delete flow version because it's referenced by deleted flow interviews"

1
  • Same idea in a one liner with Debug | Execute Anonymous delete [SELECT Id FROM FlowInterview WHERE InterviewStatus = 'Error']; (may have to add limits and repeat if you get errors)
    – twamley
    Commented Apr 10 at 3:45
0

You can use the Bulk API to delete the failed FlowInterview records.

Using batchforce, for example:

$ batchforce delete FlowInterview --query "SELECT Id FROM FlowInterview WHERE InterviewStatus='Error'"

You must log in to answer this question.

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