2

I have a VisualForce page in which I want to embed a flow. This flow should dusplay conditionally, when the user clicks on a link but I just can't get it to work. I think I'm overlooking something fairly trivial. Here is my page:

<apex:page id="accounts" standardController="Account" extensions="AccountsFlow">
    <script type="text/javascript">
        function makeBasicInformationVisibile( )
        {
            var objButton   = document.getElementById( "accounts:block1:form1:startBasicInformationFlow" );
            objButton.click( );
        }
    </script>
    <flow:interview id="FlowBasicInformation" name="Basic_Information" rendered="{!isUpdatingContact}"/>
    <apex:pageBlock id="block1"> 
        <apex:form id="form1">      

            <span>
                <apex:commandButton style="visibility:hidden" value="" id="startBasicInformationFlow" immediate="true"
                reRender="FlowBasicInformation" onClick="" action="{!setUpdatingContactsTotrue}"></apex:commandButton>
            </span>         

            <apex:pageblocksection  columns="1" >
                <apex:pageBlockTable id="AccountsTable" value="{!accounts}" var="account">
                    <apex:column headerValue="{!$ObjectType.Account.fields.Name.Label}">
                        {!account.Name}
                    </apex:column>

                    <apex:column headerValue="Test">
                        <a onclick="makeBasicInformationVisibile(); return false;"> test test </a>
                    </apex:column>
                    <apex:column headerValue="{!$ObjectType.Account.fields.Industry.Label}">
                        {!account.DunsNumber}
                    </apex:column>
                    <apex:column headerValue="{!$ObjectType.Account.fields.DunsNumber.Label}">
                    </apex:column>
                </apex:pageBlockTable>
            </apex:pageblocksection>    

        </apex:form>      
    </apex:pageBlock>      
</apex:page>

and my apex code:

    public with sharing class AccountsFlow
{
    public List<Account> accounts {get; set;}
    public boolean isUpdatingContact { get; set; }


    public AccountsFlow( ApexPages.StandardController stdController )
    {
        accounts = [SELECT Name, Phone, WebSite, DunsNumber, Industry, NumberOfEmployees FROM Account];
    }

    public void setUpdatingContactsTotrue()
    {
        isUpdatingContact   = true;
    }
}
  • o and I checked: setUpdatingContactsToTrue does get called. – Jur Van Oerle Mar 25 '15 at 10:58
2

You should to wrap the flow component with another apex:outputPanel without layout and rendered tad. Then you need to rerender only this pannel:

<apex:outputPanel id="FlowBasicInformation" layout="none">
    <flow:interview  name="Basic_Information" rendered="{!isUpdatingContact}"/>
</apex:outputPanel>

On the page load your flow component not exist on the page and could not be reRendered. Thats why you need other panel that always exists and could be called and refreshed by ID.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.