0

I've created a Flow to Convert Leads and I've embedded it into a VisualForce page. The reason is so our users can Convert Leads and also look up/create Accounts, Opportunities, and Leads from this page. I want to make decisions in the VisualForce page based off the user's selection in the flow. For example, there's a check box in the Flow (Create Opportunity) and once a user selects that check box, I would like to render the Opportunity output panel and not show the Account and Lead section in the VisualForce page. Here's the current code I've created. I feel like I'm really close but I'm not sure why nothing's rendering. So basically I have 3 output panels and if I can get one to render from the checkbox in my flow, then I could render the others from the flow. Thanks in advance!

Controller code:

public class convertLeadFlowClass {

//Lead
public Lead lead { get; private set; }
//Account
public Account account { get; set; }
//Oppurtunity
//User
//Contact
//Flow Interview
public Flow.Interview.Convert_Leads_to_Opportunities SGIConvertLead { get; set; }
public string varLeadId {get; set;}
public Boolean varCreateOpp{get;set;}
    public Boolean getVarCreateOpp()
    {
        return (Boolean)(SGIConvertLead.getVariableValue(varLeadId));
    }
public convertLeadFlowClass (ApexPages.StandardController stdController){
    lead = (Lead)stdController.getRecord();
    system.debug('Lead ' + lead);
    map<String, Object> myMap = new map<String, Object>();
    myMap.put(varLeadId, lead);
    SGIConvertLead = new Flow.Interview.Convert_Leads_to_Opportunities(myMap);

} 
}

VF Page code: -->

<flow:interview name="Convert_Leads_to_Opportunities" interview="{!SGIConvertLead}" reRender="ConvertLeadPanel">
    <apex:param name="varLeadId" value="{!Lead.Id}" />
    <apex:param name="varCreateOpp" value="{!varCreateOpp}">
        <apex:actionSupport event="onchange" reRender="ConvertLeadPanel" onsubmit="ReloadParent()" immediate="true"/>
    </apex:param>
</flow:interview>


<!--<apex:form > -->
<!--<apex:outputPanel id="ConvertLeadPanel" > -->
    <apex:pageblock id="ConvertLeadBlock" title="Lead Convert">
       <!-- <c:contactsearchcomponent id="frmId" rendered="true"> </c:contactsearchcomponent>-->

        <apex:outputPanel id="ConvertLeadPanel" >
        <apex:outputPanel id="AccountPanel" rendered="true">
            <apex:pageBlockSection id="a" title="Account" collapsible="true" rendered="{!varCreateOpp}">
                <!--<c:contactsearchcomponent id="frmId" rendered="true"> </c:contactsearchcomponent>-->
                <apex:pageBlockSectionItem >
                    <c:ContactSearchComponent id="frmId" rendered="true"> </c:ContactSearchComponent>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        </apex:outputPanel>
        </apex:outputPanel>

        <apex:outputPanel id="opportunityPanel" rendered="!varCreateOpp">
            <apex:pageblockSection id="o" title="Opportunity"
                collapsible="false">
                <apex:pageBlockSectionItem id="OpportunityPageSection">
                    <apex:outputText value="This is a Test and it worked" />
                    <apex:iframe src="https://intergraph--testval.cs7.my.salesforce.com/home/home.jsp"
                        frameborder="0" width="600" height="450" scrolling="true"
                        title="Opportunity" rendered="{!varCreateOpp}" />
                </apex:pageBlockSectionItem>
            </apex:pageblockSection>
        </apex:outputPanel>

        <apex:outputPanel id="LeadPanel" rendered="!varCreateOpp">
            <apex:pageblockSection id="c" title="Lead" collapsible="false">
                <apex:pageBlockSectionItem id="LeadPageSection">
                    <apex:outputText value="This is a Test and it worked" />
                </apex:pageBlockSectionItem>
            </apex:pageblockSection>
        </apex:outputPanel>

    </apex:pageblock>
      <!--  </apex:outputPanel> -->
        <!--</apex:form> -->

   </apex:page>
2
  • What a strange syntax is it: rendered="!varCreateOpp" Commented Feb 10, 2015 at 16:10
  • agreed. I changed it to "{!varCreateOpp}" and it still doesn't work. Commented Feb 10, 2015 at 16:23

1 Answer 1

1

I was able to make this work by using something like String.valueOf(SGIConvertLead.varLeadId)

I think you also may need to change these:

public string varLeadId {get; set;}
public Boolean varCreateOpp{get;set;}
    public Boolean getVarCreateOpp()

like so:

public string varLeadId;
//deleted because the getter is defined below -- as String, not Boolean
    public String getVarCreateOpp()

You must log in to answer this question.

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