5

I'm trying to delete some old flow which are inactive via workbench.

DestructiveChanges.xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Advanced_Round_Robin</members>
        <name>Flow</name>
    </types>Ï
</Package>

package.xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">    
  <version>48.0</version>
</Package>

I've added both file in zip and in workbench when I deploy using this zip file I get below error.

insufficient access rights on cross-reference id

enter image description here

What permission I need to have to perform this action?

Also is there way I can delete few version of same flow only? Like keep only last 3-4 version and delete all previous version of given flow?

Thank you.

4

4 Answers 4

6

I have experienced this issue in the past. According to this release doc, version numbers of the flow are omitted in API 44.0+. However when you try to do a destructive change deployment to delete a version of the flow using API 44.0 or higher it lets you delete ONLY if the version number is appended to the flow name.

For example -- If your destructive changes look like below, with hyphenated version number, it will be deleted

<types>

  <members>FlowName-4</members>

  <name>Flow</name>

 </types>

The Salesforce product team has confirmed this as expected behavior. The documentation says “To deploy or retrieve a version, you can specify the version number. For example, sample flow-3 specifies version 3 of the flow whose unique name is sample flow. If you don’t specify a version number, the flow is the latest version.”

10

Mass delete flow version is also possible via Tooling API (using Salesforce inspector chrome extension or another tool of your choice)

  1. Export flow version records by querying on FlowVersionView
SELECT DurableId, FlowDefinitionView.ApiName, VersionNumber, Status 
from FlowVersionView 
where  FlowDefinitionView.ApiName='YOUR_FLOW_API_NAME'
  1. If you are using Salesforce inspector chrome extension, go to Data Import Enable Tooling API
  2. Then choose DELETE action on Flow object by matching Id with DurableId column in exported results

Note:

You can delete a flow version as long as it isn’t active and has no paused interviews. If the flow version has paused interviews, wait for those interviews to resume and finish, or delete them.

More info

2
  • 1
    I had did extension, but didn't realize how powerful it was. Thanks so much; my clicking finger appreciates it ;) Commented Jan 8, 2023 at 3:06
  • @CharlesNaccio thanks. yes the plugin is a life saver sometimes, good to know this answer helped u
    – Shamina
    Commented Jan 8, 2023 at 4:45
0
  1. Query the Flows you'd like to delete (additionally you can filter by VersionNumber):

    SELECT Id,DurableId FROM FlowVersionView WHERE FlowDefinitionView.ApiName = 'Flow_Api_Name' AND VersionNumber < 20

  2. Copy Values in Excel and use the DurableId as the Id (FlowVersionView record id): enter image description here

  3. Using Salesforce Inspector, do a "Data Import", select 'Tooling' in API Type, enter '10' as the Batch size, paste the copied excel list and click on Run Delete enter image description here

0

You can query the Flow object directly using the Tooling API and then delete the versions via Salesforce Inspector Reloaded. Here is an example query to fetch the flow versions:

SELECT Id, Status, VersionNumber 
FROM Flow 
WHERE MasterLabel = 'FLOW_API_NAME' 
AND Status != 'Active' 
ORDER BY VersionNumber

Here's an image showing how to delete it with Salesforce Inspector Reloaded enter image description here

You must log in to answer this question.

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