【发布时间】:2020-10-07 22:38:02
【问题描述】:
下面是我的控制器
public class FlowController {
public String flowResult {get; set;}
Map<String, Object> inputs = new Map<String, Object>();
public Integer ICP_Count {get; set;}
public String dbHtml {get; set;}
Flow.Interview.Flow_ICP_Component_Update_Workflow myFlow =
new Flow.Interview.Flow_ICP_Component_Update_Workflow (inputs);
public void start() {
myFlow.start();
ICP_Count = Integer.valueOf(myFlow.getVariableValue('ICP_Count'));
flowResult = 'Flow Completed';
}
}
Visualforce 页面
<apex:page controller="FlowController">
<apex:pageBlock title="ICP Component Flows">
<apex:form>
<apex:commandButton action="{!start}" value="UpdateComponentWorkflow" reRender="text"/>
<br></br>
<apex:outputLabel id="text">Total ICPs Processed = {!ICP_Count}</apex:outputLabel>
<br></br>
<apex:outputLabel id="text3">FlowResult = {!flowResult}</apex:outputLabel>
</apex:form>
</apex:pageBlock>
</apex:page>
当我第一次单击“UpdateComponentWorkflow”按钮时,流程似乎运行良好并更新了“Total ICPs Processed”字段。但是,它不会更新“FlowResult”。当我再次单击该按钮时,出现以下错误
Interview already started.
Error is in expression '{!start}' in component <apex:commandButton> in page flow_jobs: Class.Flow.Interview.start: line 51, column 1
Class.FlowController.start: line 15, column 1
An unexpected error has occurred. Your solution provider has been notified. (Flow)
要让按钮再次工作,我必须刷新页面。我的假设是流程(自动启动)没有正确结束或与 VF 页面的生命周期有关。我想要一些关于这方面的指导。
【问题讨论】:
-
But, it doesn't update the FlowResult- 我想出了这部分,我将 text3 添加到 reRender 中,现在可以使用了。
标签: salesforce apex visualforce salesforce-lightning