无法获取进程启动变量
Can't get process start variables
我正在尝试通过 rest 获取进程启动变量,但我无法接收到任何启动变量。
当我尝试时:
http://192.168.30.1:8080/engine-rest/process-definition/key/invoice/form-variables
我只有这个:
{}
如何获取进程启动变量?
那是因为资源 Get Start Form Variables only supports Generated Start Forms。
发票流程使用 Embedded Start Form。发票流程的开始事件引用外部 HTML 文件,该文件用于呈现开始表单。
见here:
<startEvent id="StartEvent_1" name="Invoice received" camunda:formKey="embedded:app:forms/start-form.html">
<outgoing>SequenceFlow_1</outgoing>
</startEvent>
如果要接收启动表单变量,流程的启动事件必须如下例所示:
<startEvent id="start">
<extensionElements>
<camunda:formData>
<camunda:formField id="stringField" label="String Field" type="string" defaultValue="someString">
<camunda:validation>
<camunda:constraint name="maxlength" config="10" />
<camunda:constraint name="minlength" config="5" />
</camunda:validation>
</camunda:formField>
<camunda:formField id="longField" label="Long Field" type="long" defaultValue="5">
<camunda:validation>
<camunda:constraint name="max" config="10" />
<camunda:constraint name="min" config="3" />
</camunda:validation>
</camunda:formField>
<camunda:formField id="customField" label="Custom Field" type="string">
<camunda:validation>
<camunda:constraint name="validator" config="org.camunda.bpm.engine.test.api.form.CustomValidator" />
</camunda:validation>
</camunda:formField>
<camunda:formField id="dateField" label="Date Field" type="date" defaultValue="10/01/2013" />
</camunda:formData>
</extensionElements>
</startEvent>
有关完整的示例过程,请参阅 here。
在这种情况下,FormService 可以解析表单变量并且请求将 return 定义的变量。
我正在尝试通过 rest 获取进程启动变量,但我无法接收到任何启动变量。
当我尝试时:
http://192.168.30.1:8080/engine-rest/process-definition/key/invoice/form-variables
我只有这个:
{}
如何获取进程启动变量?
那是因为资源 Get Start Form Variables only supports Generated Start Forms。
发票流程使用 Embedded Start Form。发票流程的开始事件引用外部 HTML 文件,该文件用于呈现开始表单。
见here:
<startEvent id="StartEvent_1" name="Invoice received" camunda:formKey="embedded:app:forms/start-form.html">
<outgoing>SequenceFlow_1</outgoing>
</startEvent>
如果要接收启动表单变量,流程的启动事件必须如下例所示:
<startEvent id="start">
<extensionElements>
<camunda:formData>
<camunda:formField id="stringField" label="String Field" type="string" defaultValue="someString">
<camunda:validation>
<camunda:constraint name="maxlength" config="10" />
<camunda:constraint name="minlength" config="5" />
</camunda:validation>
</camunda:formField>
<camunda:formField id="longField" label="Long Field" type="long" defaultValue="5">
<camunda:validation>
<camunda:constraint name="max" config="10" />
<camunda:constraint name="min" config="3" />
</camunda:validation>
</camunda:formField>
<camunda:formField id="customField" label="Custom Field" type="string">
<camunda:validation>
<camunda:constraint name="validator" config="org.camunda.bpm.engine.test.api.form.CustomValidator" />
</camunda:validation>
</camunda:formField>
<camunda:formField id="dateField" label="Date Field" type="date" defaultValue="10/01/2013" />
</camunda:formData>
</extensionElements>
</startEvent>
有关完整的示例过程,请参阅 here。 在这种情况下,FormService 可以解析表单变量并且请求将 return 定义的变量。