自定义动作
批量创建自定义动作
批量创建自定义动作
鉴权方式
AppKey + Sign 是应用密钥鉴权,由管理员创建,用于以应用管理员身份访问应用数据。
版本
请求地址
Path 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
worksheet_id | string | 是 |
Header 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
HAP-Appkey | string | 是 | HAP应用密钥 |
HAP-Sign | string | 是 | HAP签名 |
Body 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
worksheetId | string | 是 | 工作表别名或id |
actions | object[] | 是 | — |
actions.name | string | 是 | 按钮名称 |
actions.remark | string | 否 | hover按钮时显示的按钮说明,当按钮需要特别说明时填写 |
actions.type | string | 是 | 直接触发工作流=triggerWorkflow, 填写记录=updateCurrentRecord,必填:updateFields,runWorkflowAfterSubmit 新增关联记录=createRelatedRecord,必填:relationField,runWorkflowAfterSubmit |
actions.updateFields | string[] | 否 | 填写的字段别名或id |
actions.relationField | string | 否 | 关联记录字段别名或id |
actions.runWorkflowAfterSubmit | boolean | 否 | 提交后触发工作流:false不触发,ture触发 |
actions.enableWhen | object | 否 | 筛选器配置 |
actions.enableWhen.type | string | 是 | 筛选类型,当type为condition时,field/operator/value为必填;当type为group时,logic为必填 可选值: "group""condition" |
actions.enableWhen.logic | string | 否 | 逻辑操作符,不区分大小写 可选值: "AND""OR" |
actions.enableWhen.field | string | 否 | 字段ID或别名(当type为condition时必填) |
actions.enableWhen.operator | string | 否 | 运算符(当type为condition时必填) |
actions.enableWhen.value | any | 否 | 条件值(当type为condition时必填) |
actions.enableWhen.children | object[] | 否 | 子筛选条件(当type为group时使用) |
actions.enableWhen.children.type | string | 是 | 筛选类型,当type为condition时,field/operator/value为必填;当type为group时,logic为必填 可选值: "group""condition" |
actions.enableWhen.children.logic | string | 否 | 逻辑操作符,不区分大小写 可选值: "AND""OR" |
actions.enableWhen.children.field | string | 否 | 字段ID或别名(当type为condition时必填) |
actions.enableWhen.children.operator | string | 否 | 运算符(当type为condition时必填) |
actions.enableWhen.children.value | any | 否 | 条件值(当type为condition时必填) |
actions.enableWhen.children.children | object | 否 | 筛选器配置 |
actions.enableWhen.children.children.type | string | 是 | 筛选类型,当type为condition时,field/operator/value为必填;当type为group时,logic为必填 可选值: "group""condition" |
actions.enableWhen.children.children.logic | string | 否 | 逻辑操作符,不区分大小写 可选值: "AND""OR" |
actions.enableWhen.children.children.field | string | 否 | 字段ID或别名(当type为condition时必填) |
actions.enableWhen.children.children.operator | string | 否 | 运算符(当type为condition时必填) |
actions.enableWhen.children.children.value | any | 否 | 条件值(当type为condition时必填) |
actions.enableWhen.children.children.children | object[] | 否 | 子筛选条件(当type为group时使用) |
actions.enableWhen.children.children.children.type | string | 是 | 筛选类型,当type为condition时,field/operator/value为必填;当type为group时,logic为必填 可选值: "group""condition" |
actions.enableWhen.children.children.children.logic | string | 否 | 逻辑操作符,不区分大小写 可选值: "AND""OR" |
actions.enableWhen.children.children.children.field | string | 否 | 字段ID或别名(当type为condition时必填) |
actions.enableWhen.children.children.children.operator | string | 否 | 运算符(当type为condition时必填) |
actions.enableWhen.children.children.children.value | any | 否 | 条件值(当type为condition时必填) |
actions.enableWhen.children.children.children.children | object | 否 | 筛选器配置 |
响应参数
200成功创建自定义动作| 名称 | 类型 | 描述 |
|---|---|---|
success | boolean | 是否调用成功 |
error_code | integer | 错误代码 |
error_msg | string | 错误消息 |
data | object | — |
data.actions | object[] | 已创建的自定义动作列表 |
data.actions.id | string | 自定义动作 ID |
data.actions.name | string | 自定义动作名称 |
data.actions.workflowId | string | 关联工作流 ID |
curl -X POST "https://example.com/v3/app/worksheets/worksheet_id/custom-actions/batch" \ -H "HAP-Appkey: {{HAP-Appkey}}" \ -H "HAP-Sign: {{HAP-Sign}}" \ -H "Content-Type: application/json" \ -d '{ "worksheetId": "worksheet_id", "actions": [ { "name": "填写", "type": "updateCurrentRecord", "updateFields": [ "field_id" ], "runWorkflowAfterSubmit": false } ] }'{ "success": true, "error_code": 1, "data": { "actions": [ { "id": "action_id", "name": "Test action", "workflowId": "" } ] }}