UpdateDocument

≥4.6

接口功能

更新指定 Form的文档,可以同时触发 workflow

请求参数
参数 类型 说明
input UpdateDocumentInput 更新文档实体

[warning] 注意

  • 通过指定 DocIds 的方式通过 SearchItem 也可以实现,但是在部分场景下该方法更方便,算是语法糖。
  • DocIds 和 SearchItem 互斥
  • DocIds 的优先级比 SearchItem 高。如果参数中指定了 DocIds ,则接口会忽略 SearchItem 。
  • Order 和 Size 参数只在通过 SearchItem 方式更新且触发workflow时才起作用。
  • 如果出现操作时间长的问题,可以通过 Size 参数控制每次操作的数据量。

返回数据类型(Data部分)

不触发workflow时: int,其中result为1时成功,其他值失败 触发workflow时,List, object具体如下:

new
{
  dataId = DocId,
  result = 1,
  msg = result == "1" ? "Process successed" : "To deal with failure"
}

[warning] 注意

不触发workflow的情况,所有文档有统一结果。即成功都成功,失败都失败。 触发workflow的情况,每个文档有独立结果。

输入示例1
//本示例使用DocId更新document
{
    "EntityName": "demoformalias",
    "StaffId": "d515f318-40a4-481f-8afb-d4fd5ed3f1a2",
    "StaffName": "DemoUser",
    "ActionMessage": "Test Web API Update Document",
    "FieldsValue": {
        "textbx_name": "bbj update",
        "textbx_address": "China Hebei"
    },
    "DocIds": [
        "24e6fb5a8c044caebce4cedc8c9b6e49"
    ]
}
输入示例2
//本示例使用Search方式更新document
{
    "SearchItem": [
        {
            "Method": "And",
            "Name": "Name",
            "Operator": "Equal",
            "SubSearchItems": null,
            "Value": "DemoUser"
        }
    ],
    "FieldsValue": {
        "IsDeleted": "1"
    },
    "EntityName": "DemoFormAlias",
    "StaffId": "DemoUser",
    "StaffName": "DemoUser",
    "ActionMessage": "test msg"
}
输入示例3
/*
本示例同时指定了DocIds和SearchItem,但是因为两者互斥,而且DocIds优先级更高,所以会忽略SearchItem
最终,本示例实现的功能即:更新DocIds中指定的两条文档,并且触发wf
*/
{
    "DocIds": [
        "a75d1183975a4c7f8983c86f37795e27",
        "92b62c1aeaed436abc4b35ac2d45ffe6"
    ],
    "SearchItem": [
        {
            "Method": "And",
            "Name": "Name",
            "Operator": "Equal",
            "SubSearchItems": null,
            "Value": "DemoUser"
        }
    ],
    "FieldsValue": {
        "IsDeleted": "1"
    },
    "EntityName": "DemoFormAlias",
    "StaffId": "DemoUser",
    "StaffName": "DemoUser",
    //触发workflow中的action
    "ActionCode": "150bc584736a496b9f58412dbd0ce7a7",
    //按照创建时间倒序
    "Order": {
        "C4-CreateDate": -1
    },
    //仅更新2条数据
    "Size": 2,
    "ActionMessage": "test msg"
}
返回示例1
//不触发workflow,仅更新文档
{
    "StatusCode": 200,
    "Info": "Request (or process) succeeded",
    "Data": 1
}
返回示例2
//触发workflow时
{
    "StatusCode": 200,
    "Info": "Request (or process) succeeded",
    "Data": [
        {
            "dataId": "7d5b134b-3b89-413f-ad4e-86d21f98a62e",
            "result": "1",
            "msg": "Process successed"
        }
    ]
}
© Digital Maker Product Team all right reserved,powered by Gitbook该文件修订时间: 2023-02-02 10:40:12

results matching ""

    No results matching ""