Salesforce 使用字符串列表填充visualforce页面中的下拉列表
我试图模仿salesforce潜在客户转换流程。我有一个visualforce页面和一个控制器。我遇到的问题是,当页面加载时,下拉列表为空。我的目标是有一个字符串列表,并用这个列表填充下拉列表。我上下搜索过,不明白为什么下拉列表是空白的。这是我的代码,谢谢你的帮助 --控制器--Salesforce 使用字符串列表填充visualforce页面中的下拉列表,salesforce,visualforce,apex,force.com,Salesforce,Visualforce,Apex,Force.com,我试图模仿salesforce潜在客户转换流程。我有一个visualforce页面和一个控制器。我遇到的问题是,当页面加载时,下拉列表为空。我的目标是有一个字符串列表,并用这个列表填充下拉列表。我上下搜索过,不明白为什么下拉列表是空白的。这是我的代码,谢谢你的帮助 --控制器-- public与共享类控制器{ 公共引导l{get;私有集;} 公共帐户a{get;private set;} 公共列表选项{get;set;} 公共字符串attachToclient{get;set;} 公共LeadC
public与共享类控制器{
公共引导l{get;私有集;}
公共帐户a{get;private set;}
公共列表选项{get;set;}
公共字符串attachToclient{get;set;}
公共LeadConvertController(ApexPages.StandardController sc){
对于(潜在客户推荐:[选择Id、姓名、电话、所有者Id
来自铅
其中Id=:sc.getId()){
l=转诊;
}
if(l==null){
system.debug(logginglevel.error,“缺少线索”);
}
//按姓名和电话查询以查找可能的现有帐户或联系人
选项=FindExistingClient(l);
}
公共列表FindExistingClient(Lead LeadtoAc){
list findClient=new list();
对于(帐户帐户:[从帐户中选择Id、名称、类型、主要联系人,其中名称=:leadToacc.Name或电话=:leadToacc.Phone]){
添加(新的选择选项(acc.Id,'附加到现有:'+acc.Name));
a=acc;
}
对于(联系人c:[从联系人中选择Id、姓名,其中姓名=:leadToacc.Name或电话=:leadToacc.Phone]){
添加(新的SelectOption(c.Id,'附加到现有:'+c.Name));
}
添加(新选择选项(l.Name,'createnewclient/Prospect:'+l.Name));
返回FindClient;
}
}
--视觉力页--
看法
apex:selectOptions必须位于“apex:selectlist”的开始标记和结束标记之间
请使用以下代码:
<apex:page title="Lead Convert" standardController="Lead" tabStyle="Lead" extensions="LeadConvertController">
<apex:sectionHeader title="Convert Referral" subtitle="{!l.Name}">
<apex:outputPanel id="main" rendered="true">
<apex:form>
<apex:pageBlock>
<apex:pageBlockButtons>
<apex:commandButton action="{!convert}" id="Convert" value="Convert" />
<apex:commandButton action="{!cancel}" id="Cancel" value="Cancel" />
</apex:pageBlockButtons>
<apex:pageBlockSection title="Convert Referral" collapsible="false" columns="1">
<apex:inputField label="Record Owner" value="{!l.OwnerId}" required="true" />
<apex:pageBlockSectionItem>
<apex:outputPanel>
<apex:outputLabel value="Client/Prospect Name" />
<apex:selectlist value="{!attachToclient}" required="true" />
<apex:selectOptions value="{!options}" />
</apex:selectlist>
<apex:outputlink title="View" value="{!a.Primary_Contact__c}">View</apex:outputlink>
</apex:outputPanel>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:outputPanel>
看法