HTTP 连接器 - 同意或拒绝流程审批
1. 使用场景
本例介绍一下如何使用钉钉开放平台 OpenAPI 同意或拒绝流程审批。
1.1. 连接器介绍文档
2. 实现功能
2.1. 申请钉钉开放平台应用凭证及接口权限
若已申请,可忽略此步骤。
此处为语雀内容卡片,点击链接查看:宜搭自定义连接器鉴权凭证申请及接口权限申请
2.2. 创建 HTTP 连接器
本例用到的钉钉开放平台接口:
2.2.1. 创建 HTTP 连接器
配置获取流程审批记录连接器详见:HTTP 连接器 - 钉钉开放平台 - 获取流程审批记录

2.2.2. 配置连接器基本信息和登录方式


2.2.3. 配置连接器执行动作

配置接口请求 Headers 参数:

配置接口请求 Body 参数:

{
"outResult" : "String",
"noExecuteExpressions" : "String",
"appType" : "String",
"systemToken" : "String",
"remark" : "String",
"processInstanceId" : "String",
"userId" : "String",
"taskId" : 12002575
}
接口返回:

2.2.4. 配置鉴权模板
若无账号,需新增账号,账号所需参数参考 2.1:
鉴权模板具体配置可参考:
此处为语雀内容卡片,点击链接查看:宜搭自定义连接器鉴权模板配置
2.3. 配置页面并配置集成自动化
特别注意:连接器节点所使用的 appType、systemToken 请按照以下步骤查找。
查看路径:系统后台 -> 应用设置 -> 部署运维

2.3.1. 配置流程表单(流程表单)

2.3.2. 配置流程中间表(普通表单)
【流程表单】创建成功后,使用集成自动化将数据新增到该表,主要记录【流程表单】的实例ID及流程状态,用于【同意或拒绝流程审批】做关联表单。

2.3.3. 配置执行审批操作表
关联【流程中间表】,配置显示字段及填充内容。

配置填充规则。

配置「审批结果」字段的选项/显示值:

配置「是否不执行校验和关联操作」字段的选项/显示值:

2.3.4. 配置流程表单集成自动化
【流程表单】表单创建成功 -> 新增【流程中间表】数据,记录流程实例ID。

流程审批成功 -> 获取【流程中间表】单条数据-> 更新【流程中间表】数据。



2.3.5. 配置流程操作表集成自动化
创建成功 ->「连接器节点」获取审批记录 -> 「脚本节点」处理审批记录返回的 taskId 和 userId ->「连接器节点」执行审批任务。


「脚本节点」处理返回参数:

var todoTasks = approvalRecords.filter(function(item) {
return item.type === "TODO";
});
var todoTaskIds = todoTasks[0].taskId;
var userId = todoTasks[0].operatorUserId;
outputs.add("任务id", "todoTaskIds", todoTaskIds);
outputs.add("审批人userId", "userId", userId);
「连接器节点」执行审批任务:

3. 实现效果


4. 在线试玩
本文档对您是否有帮助?