I'm trying to pass a value selected from a SOQL query, from the VF page to a Visual Workflow. The value I am trying to pass is selectedRibbonClauses. I dont get an error message when i try to save the VF page or controller, but the value doesnt show up in the flow when i try to reference it. When I hardcode a value for the selectedRibbonClauses field, it gets passed into the flow and shows up in the screen element. Can someone help me, where I'm going wrong?

Part of me thinks it could be something as simple as my syntax or how I'm referencing the variable in the code.

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

            <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="/{!$CurrentPage.parameters.Id}">
    <apex:param name="vRibbonClauseId" value="{!selectedRibbonClauses}" />
    <apex:param name="v_UserId" value="{!$User.Id}"/>
    <apex:param name="vMId" value="{!$CurrentPage.parameters.Id}"/>

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;}
    // 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() {

        // clear out the currently selected categories

        // add the selected categories to a new List
        for (RibbonClauseWrapper rcw : searchResults) {
            if (rcw.checked)
                selectedRibbonClauses.add(new RibbonClauseWrapper(rcw.rc));

        // ensure they selected at least one ribbonclause or show an error message.
        if (selectedRibbonClauses.size() > 0) {
            return Page.RibbonClause_Results;
        } else {
            ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Please select at least one RibbonClause.'));
            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;


Here is my wrapper:

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;


1 Answer 1


It seems like selectedRibbonClauses is a list of RibbonClauseWrapper which you are trying to pass as a parameter. Also, in the flow you must be taking its value in some variable which is of course not of RibbonClauseWrapper type. So, it is not showing up the value in the flow and when you are hard coding some value, the variable will pick that value. So, instead of passing the Wrapper, pass the specific value.

  • Thanks. it might help to explain what the visualforce page does - it has a search box. You enter text, it runs a dynamic query, and returns a list of results. The user then can check which record from the results they want, then they click a "Use Selected" button and it should pass the result to the results page, which kicks off the flow. I thought that you had to use a wrapper this way in order to query and then select a record, but i could be wrong.
    – Clink
    Commented Jul 10, 2017 at 6:37
  • So, you have passed the complete wrapper in the flow which is I suppose is not a correct way. You should pass the Id of the records selected by the user as the parameter in the flow. Try this out and let me know if you face any other issues.
    – Ankita
    Commented Jul 10, 2017 at 7:55

You must log in to answer this question.

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