I'm using a custom controller, wrapper, and a visualforce page trying to pass a List of selected items into a Visual Workflow.
I'm able to run the query and make a selection, via the wrapper, in the VF page, and I know that the variable I'm trying to pass is populating values (as I've checked the debug logs) but I am unable to get it to pass into the visual workflow. Can someone help?

Below is my controller:

public class RibbonClauseSearchControllerv2 {

    // the results from the search. do not init the results or a blank rows show up initially on page load
    public List<RibbonClauseWrapper> searchResults {get;set;}
    List<RibbonClause__c> ribbonClauseList;
    public List<RibbonClause__c> getRibbonClauseList() {
        return ribbonClauseList;
    // the categories that were checked/selected.
    public List<RibbonClauseWrapper> selectedRibbonClauses {
        get {
            if (selectedRibbonClauses == null) selectedRibbonClauses = new List<RibbonClauseWrapper>();
            return selectedRibbonClauses;

    // the text in the search box
    public string searchText {
        get {
            if (searchText == null) searchText = 'Type Value'; // prefill the search box for ease of use
            return searchText;

    // constructor
    public RibbonClauseSearchControllerv2() {}

    // fired when the search button is clicked
    public PageReference search() {

        if (searchResults == null) {
            searchResults = new List<RibbonClauseWrapper>(); // init the list if it is null
        } else {
            searchResults.clear(); // clear out the current results if they exist
        // Note: you could have achieved the same results as above by just using:
        // searchResults = new List<RibbonClauseWrapper>();

        // dynamic soql for fun
        String qry = 'Select rc.Name, rc.Id, rc.Text__c, rc.Clause_Name__c, rc.Additional_NST_Details__c From RibbonClause__c rc Where rc.Name LIKE \'%'+searchtext+'%\' Order By rc.Name';
        // may need to modify for governor limits??
        for(RibbonClause__c rc : Database.query(qry)) {
            // create a new wrapper by passing it the category in the constructor
            RibbonClauseWrapper rcw = new RibbonClauseWrapper(rc);
            // add the wrapper to the results
        return null;

    public PageReference next() {
        List<RibbonClause__c> ribbonclauseList = new List<RibbonClause__c>();

        // clear out the currently selected 
//        selectedRibbonClauses.clear();
//        ribbonclauseList.clear();

        // add the selected ribbonclause to a new List
        for (RibbonClauseWrapper rcw : searchResults) {
            if (rcw.checked)

//        // Now we have our list of selected contacts and can perform any type of logic we want, sending emails, updating a field on the Contact, etc
//        System.debug('These are the selected Ribbonclauses...' + ribbonclauseList);
//        for(RibbonClause__c rcf: ribbonclauseList) {
//            system.debug(rcf);
//        }
//       ribbonclauseList =null; // we need this line if we performed a write operation  because getContacts gets a fresh list now
         return Page.RibbonClause_Results;
//         return null;


    // fired when the back button is clicked
    public PageReference back() {
        return Page.RibbonClause_Search;

    // fired when no clause available button is clicked
    public PageReference noclause() {
        return Page.clauseKeyPage;

    public PageReference getListView() {
        return new PageReference('https://cs-iris--rksb1.cs17.my.salesforce.com/a1X?fcf=00Bg0000001HSu1');

public class ribbonClauseWrapper {

    public Boolean checked{get;set;}
    public RibbonClause__c rc{get;set;}

    public RibbonClauseWrapper(){
        rc = new RibbonClause__c();
        checked = false;

    public RibbonClauseWrapper(RibbonClause__c rc2){
        rc = rc2;
        checked = false;



This is my Visualforce Page that initiates the Flow.

<apex:page controller="RibbonClauseSearchControllerv2">  
    <apex:form >
        <apex:pageBlock rendered="True" >

            <apex:pageBlockButtons >
                <apex:commandButton action="{!back}" value="Back"/>
            <apex:pageMessages />

            <apex:pageBlockSection title="You Selected" columns="1" collapsible="true">
                <apex:pageBlockTable value="{!selectedRibbonClauses}" var="rc2" style="width:100%">
                    <apex:column value="{!rc2.rc.Name}" headerValue="Name" Style="width:100px"/>
                    <apex:column value="{!rc2.rc.Text__c}" headerValue="Language" Style="width:600px"/>
                    <apex:column value="{!rc2.rc.Id}" headerValue="Id" Style="width:1px" rendered="false" />


    <flow:interview name="Approval_Record_Creation" buttonLocation="top" finishLocation="{!ListView}">

    <apex:param name="cv_RibbonClauseId" value="{!ribbonClauseList}" />
    <apex:param name="v_UserId" value="{!$User.Id}"/>
    <apex:param name="vMId" value="{!$CurrentPage.parameters.Id}"/>

The parameter giving me trouble is

apex:param name="cv_RibbonClauseId" value="{!ribbonClauseList}"

When I hard code an ID for the value here then it passes into my flow fine.

I also ran a System.Debug in the controller for the ribbonClauseList in the controller. I commented it out in the controller that I've pasted here, but the snippet of it is below:

System.debug('These are the selected Ribbonclauses...' + ribbonclauseList);
      for(RibbonClause__c rcf: ribbonclauseList) {

In the Debug logs it shows records of type RibbonClause__c, so i know that the variable is being populated.....

So.. 1) I can hardcode a value in the VF page for the flow variable which comes through correctly in the floe and 2) I know that the variable I'm trying to pass into the flow is being populated with values... Can someone help me understand where the gap is that I'm missing?

  • duplicate of: > Wrapper Lists and Visual Workflow Variables : salesforce.stackexchange.com/questions/183852/… > Variable not Being Passed from Visualforce/custom controller to Flow : salesforce.stackexchange.com/questions/183429/… > How to query and pass selected records from a VF Page to Visual Workflow? : salesforce.stackexchange.com/questions/182026/… – gorav Jul 13 '17 at 16:39
  • Yes thanks. I've asked several different questions on this topic as I've tried different techniques. But still not made much headway. Would greatly appreciate any support! – Clink Jul 13 '17 at 21:54
  • @gorav Thanks, I really appreciate youre useful insight! – Clink Jul 14 '17 at 23:33
  • What type of variable are you passing it into? It should be a sObject collection and the variable must be marked as input only or input and output, else nothing can be passed in. Also, it is case sensitive so make sure that it's exactly correct. I can't help much w the code, but if the debug log is showing the values, seems like the code is ok and it's just not passing to the flow. Also, you can add a element to the flow that emails you the values it's receiving. For debugging, You could try passing the values into a text variable in the flow - not sure if that will work but maybe? – gorav Jul 15 '17 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.