After the process is submitted, the approver initiates other processes based on the subform content.
1. Case Background
When a task is distributed or a project is assigned, you can refer to the following cases when the author submits a task and requires the current approver to initiate other different processes based on the content of the subform.
2. Achieve results
💡Approvers initiate different processes based on submitted sub-table data
![](https://yida-support.oss-cn-shanghai.aliyuncs.com/static/gif/1645063775931-a80b662c-86b8-4299-bf56-65a88fd435af.gif)
3. Implementation steps
3.1 Create A, B Flow Chart
Path: Enter the created application> upper left corner of the page + sign> create flow chart
![](https://yida-support.oss-cn-shanghai.aliyuncs.com/static/png/1645060426224-86b33d0b-1172-46e6-b818-5feba3d2df41.png)
A and B Flow Chart component configurations
Note: You can set the flow chart configuration according to your needs.
![](https://yida-support.oss-cn-shanghai.aliyuncs.com/static/png/1645060577339-43c5d921-e818-400e-bcb4-1c116a890d62.png)
A flow chart component configuration
![](https://yida-support.oss-cn-shanghai.aliyuncs.com/static/png/1645060670499-89b264dc-1804-4ba5-894b-e710f2bff8ee.png)
B Flow Chart component configuration
3.2 Create an initiator flow chart
Path: Enter the created application> upper left corner of the page + sign> create flow chart
![](https://yida-support.oss-cn-shanghai.aliyuncs.com/static/png/1645060846486-dc249219-eef0-47bc-83d8-fc746fc8b605.png)
Initiate flow chart component configuration
Note: You can set the flow chart configuration according to your needs.
![](https://yida-support.oss-cn-shanghai.aliyuncs.com/static/png/1645060996701-833da7df-c35c-4b93-8f34-37ce0d4f7eda.png)
Initiate flow chart component configuration
3.3 Creation and configuration of data sources
Data Source Name: dp2
Auto load: Off
Request address:/dingtalk/web/Application coding/v1/process/startInstance.json
Request method: POST
![](https://yida-support.oss-cn-shanghai.aliyuncs.com/static/png/1645062609279-3e3601b4-636c-4bfd-b66a-b1351f7c5dd6.png)
Data source dp2 creation and configuration
Data Source Name: dp1
Auto load: Off
Request address:/dingtalk/web/Application encoding/v1/process/getOperationRecords.json
Request method: GET
![](https://yida-support.oss-cn-shanghai.aliyuncs.com/static/png/1645062855960-996e5963-779f-408c-a351-2c74107e5aba.png)
Create and configure data source dp1
3.4 Add actions and configurations to Subforms
3.4.1 add action items
![](https://yida-support.oss-cn-shanghai.aliyuncs.com/static/png/1645061105281-fbb48180-6019-4867-89fb-b002b18e1acd.png)
3.4.2 Operation item configuration
Note: the configuration of initiating A process operation is the same as that of initiating B process operation. If there are other operations, you can configure them according to your needs.
Click the action item edit button
![](https://yida-support.oss-cn-shanghai.aliyuncs.com/static/png/1645061220572-448a7c8f-449d-4537-96f0-5ecf6f61e0c5.png)
Click bind callback function
![](https://yida-support.oss-cn-shanghai.aliyuncs.com/static/png/1645061282591-b5e32d03-24b1-48d6-827e-c76bcc30534a.png)
Create a callback function
![](https://yida-support.oss-cn-shanghai.aliyuncs.com/static/png/1645061330213-e9644219-fd07-4d39-83ea-e998b0abc19b.png)
3.5 initiate A process and initiate B process callback function code configuration
3.5.1 initiate process A code configuration
![](https://yida-support.oss-cn-shanghai.aliyuncs.com/static/png/1645061729174-b9308c46-661c-4f51-82f0-41fb10d982ac.png)
Initiate process A code configuration
Sample code:
export function onActionClick({ index, groupId, itemValue, actionKey }) {
const aa = this.state.urlParams.formInstId;
console.log(aa);
const bb = this.utils.getLoginUserId();
const params = {
processInstanceId: aa
}
this.dataSourceMap.dp1.load(params).then((response) => {
console.log(response)
for(var i=1;i<response.length;i++){
if (response[i].actionExt == "doing")
{
if (response[i].operator==bb)
{
const b =
{
"A流程单行文本1组件唯一标识": itemValue.子表单单行文本1组件唯一标识,
"A流程单行文本2组件唯一标识": itemValue.子表单单行文本2组件唯一标识
}
const a = {
processCode: "A流程流程Code",
formUuid: "A流程表单id",
formDataJson: JSON.stringify(b)
}
this.dataSourceMap.dp2.load(a).then((response) => {
alert("发起成功")
})
}
else{
alert("仅当前审批人可发起")
}
}
}
})
}
3.5.2 initiate process B code configuration
![](https://yida-support.oss-cn-shanghai.aliyuncs.com/static/png/1645063081886-9354b385-9489-4704-8387-aad6a0461070.png)
Initiate process B code configuration
export function onActionClick1({ index, groupId, itemValue, actionKey }) {
const aa = this.state.urlParams.formInstId;
const bb = this.utils.getLoginUserId();
const params = {
processInstanceId: aa
}
this.dataSourceMap.dp1.load(params).then((response) => {
console.log(response)
for (var i = 1; i < response.length; i++) {
if (response[i].actionExt == "doing") {
if (response[i].operator == bb) {
const b =
{
"B流程单行文本3组件唯一标识": itemValue.子表单单行文本1唯一标识,
"B流程单行文本4组件唯一标识": itemValue.子表单单行文本2唯一标识
}
const a = {
processCode: "B流程流程Code",
formUuid: "B流程表单id",
formDataJson: JSON.stringify(b)
}
this.dataSourceMap.dp2.load(a).then((response) => {
alert("发起成功")
})
}
else{
alert("仅当前审批人可发起")
}
}
}
})
}
-------- Get the latest information on YIDA, welcome to follow US--------
![](https://yida-support.oss-cn-shanghai.aliyuncs.com/static/jpeg/1632807780139-91cbcd43-8c42-44f3-9b2d-0d8b799ab7ea.jpeg)