在钉钉中,可以通过以下步骤获取process_code:
钉钉中的process_code是钉钉审批流程的编码,可以通过获取审批实例的表单信息来获取。具体步骤如下:
需要注意的是,以上步骤需要使用钉钉提供的API接口进行调用,并且需要具备相应的权限才能访问相关数据。
获取process_code需要创建或更新审批表单模板,通过调用「创建或更新审批表单模板」接口获取返回的表单模板信息中的processCode字段即可。
——此回答整理自钉群:钉钉开发者社区(互助群)
process_code(审批流的唯一码)从哪里获取https://m.dingtalk.com/qidian/help-detail-1000100483
您好,有oa管理权限的账号登陆钉钉的管理后台,找到工作台,点击OA审批,找到对应的审批模板,点击编辑,processCode就在当前页面的URL中(地址栏)。
【温馨提示】:新版管理后台不支持查看审批流唯一码,建议切换到旧版查看。
调用创建或更新审批模板接口创建的自有审批流模板,使用的模板名称和接口返回的process_code值。
请求示例(JAVA SDK)
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/process/save");
OapiProcessSaveRequest request = new OapiProcessSaveRequest();
OapiProcessSaveRequest.SaveProcessRequest saveProcessRequest = new OapiProcessSaveRequest.SaveProcessRequest();
saveProcessRequest.setDisableFormEdit(true);
saveProcessRequest.setName("test2.0");
saveProcessRequest.setProcessCode("PROC-BE7FC6B2-E95B-45CA-AD9A-A62819EDA2FE");
saveProcessRequest.setAgentid(260536001L);
saveProcessRequest.setFakeMode(true);
// 注意,每种表单组件,对应的componentName是固定的,参照以下示例代码
List<FormComponentVo> formComponentList = Lists.newArrayList();
// 单行文本框
OapiProcessSaveRequest.FormComponentVo singleInput = new OapiProcessSaveRequest.FormComponentVo();
singleInput.setComponentName("TextField");
OapiProcessSaveRequest.FormComponentPropVo singleInputProp = new OapiProcessSaveRequest.FormComponentPropVo();
singleInputProp.setRequired(true);
singleInputProp.setLabel("单行输入框");
singleInputProp.setPlaceholder("请输入");
singleInputProp.setId("TextField-J78F056R");
singleInput.setProps(singleInputProp);
formComponentList.add(singleInput);
// 多行文本框
OapiProcessSaveRequest.FormComponentVo multipleInput = new OapiProcessSaveRequest.FormComponentVo();
multipleInput.setComponentName("TextareaField");
OapiProcessSaveRequest.FormComponentPropVo multipleInputProp = new OapiProcessSaveRequest.FormComponentPropVo();
multipleInputProp.setRequired(true);
multipleInputProp.setLabel("多行输入框");
multipleInputProp.setPlaceholder("请输入");
multipleInputProp.setId("TextareaField-J78F056S");
multipleInput.setProps(multipleInputProp);
formComponentList.add(multipleInput);
// 金额组件
OapiProcessSaveRequest.FormComponentVo moneyComponent = new OapiProcessSaveRequest.FormComponentVo();
moneyComponent.setComponentName("MoneyField");
OapiProcessSaveRequest.FormComponentPropVo moneyComponentProp = new OapiProcessSaveRequest.FormComponentPropVo();
moneyComponentProp.setRequired(true);
moneyComponentProp.setLabel("金额(元)大写");
moneyComponentProp.setPlaceholder("请输入");
moneyComponentProp.setId("MoneyField-J78F0571");
moneyComponentProp.setNotUpper("1"); // 是否禁用大写
moneyComponent.setProps(moneyComponentProp);
formComponentList.add(moneyComponent);
// 数字输入框
OapiProcessSaveRequest.FormComponentVo numberComponent = new OapiProcessSaveRequest.FormComponentVo();
numberComponent.setComponentName("NumberField");
OapiProcessSaveRequest.FormComponentPropVo numberComponentProp = new OapiProcessSaveRequest.FormComponentPropVo();
numberComponentProp.setRequired(true);
numberComponentProp.setLabel("数字输入框带单位");
numberComponentProp.setPlaceholder("请输入");
numberComponentProp.setId("NumberField-J78F057N");
numberComponentProp.setUnit("元");
numberComponent.setProps(numberComponentProp);
formComponentList.add(numberComponent);
// 日期
OapiProcessSaveRequest.FormComponentVo dateComponent = new OapiProcessSaveRequest.FormComponentVo();
dateComponent.setComponentName("DDDateField");
OapiProcessSaveRequest.FormComponentPropVo dateComponentProp = new OapiProcessSaveRequest.FormComponentPropVo();
dateComponentProp.setRequired(true);
dateComponentProp.setLabel("日期");
dateComponentProp.setPlaceholder("请选择");
dateComponentProp.setUnit("小时"); // 小时或天
dateComponentProp.setId("DDDateField-J8MTJZVE");
dateComponent.setProps(dateComponentProp);
formComponentList.add(dateComponent);
// 日期区间
OapiProcessSaveRequest.FormComponentVo dateRangeComponent = new OapiProcessSaveRequest.FormComponentVo();
dateRangeComponent.setComponentName("DDDateRangeField");
OapiProcessSaveRequest.FormComponentPropVo dateRangeComponentProp = new OapiProcessSaveRequest.FormComponentPropVo();
dateRangeComponentProp.setRequired(true);
dateRangeComponentProp.setLabel(JSON.toJSONString(Arrays.asList("a", "b")));
dateRangeComponentProp.setPlaceholder("请选择");
dateRangeComponentProp.setUnit("小时"); // 小时或天
dateRangeComponentProp.setId("DDDateRangeField-J78F057Q");
dateRangeComponent.setProps(dateRangeComponentProp);
formComponentList.add(dateRangeComponent);
saveProcessRequest.setFormComponentList(formComponentList);
request.setSaveProcessRequest(saveProcessRequest);
OapiProcessSaveResponse response = client.execute(request, accessToken);
System.out.println(JSON.toJSONString(response));
返回示例
{
"errcode": 0,
"result": {
"process_code": "PROC-7C8BB7AE-E758-4A96-9375-27CFD376B19C"
},
"request_id": "5av7ifh2atw0"
}
——参考链接。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。