来自VF页面的查找字段值未符合Visual Flow变量

时间:2016-01-12 05:25:24

标签: javascript salesforce apex-code visualforce apex

我创建了一个VF页面并在其中嵌入了可视化工作流程。 VF页面有一个查找字段,但我在通过this为流变量赋值时遇到问题。我必须单击保存按钮并通过url将参数传递给同一页面,然后在构造函数中分配值。 这可以不点击保存按钮吗? 对于查找我尝试使用动态选择元素,但问题是,一旦输入要搜索的字符串,它就会在下一个屏幕上显示结果 视觉力场和流场分开出现。有什么方法可以在同一页面中显示它吗?     以下是示例代码 -

[enter image description here][1]

在这里输入代码

<apex:sectionHeader title="New Contract Amendment"/>
   <div style ="margin-top:50px;">
    <apex:form >
        <div style="margin-left:80px;">
         <apex:outputLabel value="Contract Emailed To" style="font-weight:bold;">&nbsp;&nbsp;&nbsp;&nbsp;</apex:outputLabel>
          <apex:inputField id="Account" value="{!Contact.ReportsToId}"  />
          <apex:commandButton value="Save" action="{!getContactDetails}"/>
      </div>
      </apex:form>
  <flow:interview name="Contract_Amendment_Creation_Wizard" interview="{!myFlow}" buttonLocation="bottom" finishLocation="{!newPage}">
        <apex:param name="ContactId" value="{!selectedContactId}"/>
        <apex:param name="contract_Id" value="{!selectedContractId}"/>
    </flow:interview>
    </div>
</apex:page>

-----Controller----
public with sharing class AmendmentCreationWizardController{

    public PageReference getNewPage() {
    if(myFlow!=null){
        if(myFlow.AmendmentType =='Booth Change Amendment'){
           return new PageReference('/apex/BoothChangeAmendmentWizard?id='+myFlow.contract_Id+'&AmdId='+myFlow.amendment_Id);
         system.debug('ContractId->>'+myFlow.contract_Id);
         system.debug('ContractId->>'+myFlow.AmendmentType);
         system.debug('ContractId->>'+myFlow.amendment_Id);
        // return new PageReference('/apex/BoothChangeAmendmentWizard');

        }else{
        if(myFlow.AmendmentType =='Cancellation'){
            return new PageReference('/apex/OpportunityCancelWizard?conAmdId='+myFlow.amendment_Id+'&id='+myFlow.contract_Id);
        }else{
            return new PageReference('/'+myFlow.amendment_Id);
        }

        }
    }
        return new PageReference('null');
    }


  public String selectedContactId{get;set;}
  public String selectedContractId{get;set;}
  public Contact contact {get;set;}
  Public string Conract;
  public Flow.Interview.Contract_Amendment_Creation_Wizard myFlow{get;set;}

  //public flow.interview.Contract_Amendment_Creation_Wizard dflow{get;set;}

  public AmendmentCreationWizardController() {
      selectedContactId = 'test';  
      selectedContactId  = apexpages.currentpage().getparameters().get('ContactId');
      //selectedContactId = '003n0000008T4WL';
      selectedContractId =apexpages.currentpage().getparameters().get('ContractId');
      contact = new Contact();
  }

  public PageReference getContactDetails() {
        selectedContactId = Contact.ReportsToId;
        PageReference congratsPage = Page.ContractAmendmentCreationWizard;
        congratsPage.setRedirect(true);
        congratsPage.getParameters().put('ContactId',selectedContactId);
        congratsPage.getParameters().put('ContractId',selectedContractId);
        return congratsPage;
  }

}

1 个答案:

答案 0 :(得分:0)

我尝试过以下工作, 这里的问题是它刷新了页面。 我可以不刷新页面吗?

<apex:page Controller="AmendmentCreationWizardController" title="New Contract Amendment">

<apex:sectionHeader title="New Contract Amendment"/>
<div style ="margin-top:50px;">
    <apex:form >
        <div style="margin-left:80px;">
         <apex:outputLabel value="Contract Emailed To" style="font-weight:bold;" rendered="{!selectedContactId == NULL}">&nbsp;&nbsp;&nbsp;&nbsp;</apex:outputLabel>
          <apex:inputField id="Account" value="{!Contact.ReportsToId}" rendered="{!selectedContactId == NULL}" onChange="test1()"/>

          <apex:actionFunction name="test1" action="{!getContactDetails}" rerender="Test_2"/>
        </div>
    </apex:form>
    <apex:outputPanel id="Test_2">  
    <flow:interview name="Contract_Amendment_Creation_Wizard" interview="{!myFlow}"  id="Flow_1"  buttonLocation="bottom"  finishLocation="{!newPage}">
        <apex:param name="ContactId" value="{!selectedContactId}"/>
        <apex:param name="contract_Id" value="{!selectedContractId}"/>
  </flow:interview>
  </apex:outputPanel>

</div>
</apex:page>