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
Caleb ZautnerCaleb Zautner 

Pass in records from a Task list view to a flow using Visualforce

Hello,

I am trying to create a "Mass Clone" and a "Mass Delete" button that will be visible from the list view of Tasks. My current approach is to create a flow that takes in a collection of records and loops through to either delete or clone them. I'm just focused on the 'delete' for now, once that's working I will add to the flow or create a new one for 'update'. 
To kick off the flow, I have a visualforce page that is added to a List View button. This visualforce page should collect the marked records and pass them along to the flow. 
First, is this even possible?
Second, am I on the right track?

The flow is pretty straight-forward.
User-added imageThis is what I have for my visualforce page.
<apex:page standardController="Task" tabStyle="Task" recordSetVar="tasks">
    <apex:repeat value="{!tasks}" var="row" rendered="false">
        {!row.Id}
    </apex:repeat>
    <flow:interview name="Task_Delete">
        <apex:param name="TaskCollection" value="{!tasks}" />
    </flow:interview>
</apex:page>
Finally, here is the setup for the List View button.
User-added imageThanks in advanced!
 
ShirishaShirisha (Salesforce Developers) 
Hi Caleb,

Greetings!

Yes,you can pass the the list of record from VF page to Flow.

Please find the step by step process of this in the below document:

https://succeedwithsalesforce.com/multi-select-and-mass-update-records-in-lightning-list-views-using-flows-visualforce-and-a-list-button/

Reference:https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_flows_setting_values.htm

Kindly let me know if it helps you and close your query by marking it as best answer so that it can help others in the future.

Warm Regards,
Shirisha Pathuri

 
Caleb ZautnerCaleb Zautner
Thanks Shirisha,

I was using that site before to build out what I have so far, but it didn't seem to work. I created a test flow that should simply display the id's of all the selected tasks. I assigned the visualforce page to that flow instead, and when I run it it just shows the first 20 tasks from the list view (regardless of which tasks I have selected, if any). 

Any ideas why it's not passing through the correct id's?
All I did was create a Collection variable and used is in my visualforce page.
<apex:page standardController="Task" tabStyle="Task" recordSetVar="tasks">
    <apex:repeat value="{!tasks}" var="row" rendered="false">
        {!row.Id}
    </apex:repeat>
    <flow:interview name="Task_Delete_Test" >
        <apex:param name="Task_Collection" value="{!tasks}" />
    </flow:interview>
</apex:page>


User-added image