任务实例ID
文件附件信息记录
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let res = taskClient.addAttachments("002N000000VwBrSDISbQ", [
{
"name": "aaa",
"fileName": "a/b/c",
"category": "xxx",
"url": "xxx.com/xxx/xxx",
"taskID": "xxx",
},
{
"name": "bbb",
"fileName": "a/b/c/d",
"category": "yyy",
"url": "yyy.com/yyy/yyy",
"taskID": "yyy",
}
])
console.log(res)
返回新增文件附件信息记录的id列表
为BPM任务添加评论
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let res = taskClient.addComment("comments")
返回添加的评论相关记录
取消并行任务
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let tasks = taskClient.cancel(
"002N000000VBk5qqWi1I",
"task is end"
)
console.log(tasks)
任务状态信息
申请处理指定的任务
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let res = taskClient.claim(
"002N000000VBk5qqWi1I"
)
任务状态信息
结束任务
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let res = taskClient.complete(
"002N000000VBk5qqWi1I",
"",
{}
)
console.log(res)
任务状态信息
结束任务,并指定下一个任务的参与者(必须在下一个任务的参与者列表中,或具有管理权限)。
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let res = taskClient.completeWithAssignee(
"002N000000VBk5qqWi1I",
"user",
"",
{}
)
console.log(res)
任务状态信息
创建一个BPM子任务实例,注意parentId对应任务不能是用户任务
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let res = taskClient.createSubTask(
"002N000000VBk5qqWi1I",
"002N000000VBk5qqWaSd",
"user",
)
console.log(res)
任务状态信息
将任务进行委托
import {delegate}from 'bp'
delegate("002N000000VwBrSDISbQ","user","resons")
任务状态信息
删除任务
任务实例ID
import * as bp from 'bp'
let task = bp.newTaskClient()
task.delete("taskInsId")
删除BPM任务的文件附件信息
任务实例ID
要删除的附件信息记录id列表
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
taskClient.deleteAttachments("002N000000VwBrSDISbQ",["id1","id2"])
删除BPM任务的评论
任务实例ID
评论实例ID
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let res = taskClient.deleteComment("taskInsId","commentId")
获取某个具体的BPM任务评论
任务实例ID
评论实例ID
Optional
options: OptionItem可选参数,可部分置空或全部置空
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let res = taskClient.getComment("taskInsId","commentId")
返回某个具体的评论记录
获取BPM任务的评论
Optional
options: OptionItem可选,可部分置空或全部置空
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let res = taskClient.getComments("taskInsId")
返回相关的评论记录
获取BPM任务的变量值
import * as bp from 'bp'
let taskClient=bp.newTaskClient()
let vars = taskClient.getVars("002N000000VwBrSDISbQ", ["foo", "bar"])
console.log(vars)
变量Key-Value键值对
指定具体BPM任务ID,查任务信息
任务实例ID
Optional
options: OptionItem可选,可部分置空或全部置空
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let res = taskClient.query("002N000000VwBrSDISbQ", {
fields: ["name", "bpStatus", "createdDate", "owner"],
})
console.log(res)
任务信息
查询活跃状态的BPM任务列表,这里激活状态包括New/Dispatched/InProcess这三种任务状态
Optional
activeTaskCondition: ActiveTaskCondition查询活跃状态任务的条件,可部分留空或全部留空
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let tasks = taskClient.queryActiveList({
owner: "002I000000VBjYt2OCYK",
rootID: "002N000000VBjj8I66gC",
options: {
fields: ["assignee", "assigneeID", "assigneeType", "assigneeName", "name", "state", "rootID", "owner"],
}
})
console.log(tasks)
返回匹配的任务列表
查询BPM任务的文件附件信息记录
任务实例ID
Optional
options: OptionItem可选,可部分置空或全部置空
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let recs = taskClient.queryAttachments("002N000000VwBrSDISbQ", {
fields: ["taskID", "name", "fileName", "url"],
limit: 5,
})
console.log(recs)
查询到的文件附件信息记录
按照指定条件查BPM任务
Optional
condition: "bp".ConditionOption指定的查询条件,若不指定具体condition或option留空即可
import * as bp from 'bp'
import * as db from 'db'
let taskClient = bp.newTaskClient()
let res = taskClient.queryByCondition({
condition: {
conjunction: db.Conjunction.AND,
conditions: [
{
field: "createdDate",
operator: db.Operator.gt,
value: "2019-08-01 00:00:00"
}
]
},
options: {
fields: ["assignee", "assigneeID", "assigneeType", "assigneeName", "name"],
orderby: [
{
field: "assignee",
order: db.Order.desc
}
],
}
})
console.log(res)
返回查询出的BPM任务的记录
查询closed状态的bpm任务,示例与querySuspendList类似
Optional
queryCondition: QueryCondition查询条件,可以全部为空或部分为空
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let res = taskClient.queryClosedList({
creator: "002I000000VBjYt2OCYK",
owner: "002I000000VBjYt2OCYK"
})
console.log(res)
查询返回的任务列表
查询completed状态的bpm任务,示例与querySuspendList类似
Optional
queryCondition: QueryCondition查询条件,可以全部为空或部分为空
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let res = taskClient.queryCompletedList({
creator: "002I000000VBjYt2OCYK",
owner: "002I000000VBjYt2OCYK"
})
console.log(res)
查询返回的任务列表
按照指定条件查询BPM任务列表
Optional
queryTaskListCondition: QueryTaskListCondition查询条件
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let res = taskClient.queryList({
rootID: "002N000000VBk5qqWi1I",
states: [bp.State.Terminated, bp.State.New],
procInsID: "xxxxxxxxxxxxxxxxxx",
})
console.log(res)
查询返回的任务列表
查询属主是调用者本人的BPM任务列表
Optional
myTaskCondition: MyTaskCondition查询自己BPM任务的条件,可部分留空或全部留空
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let tasks = taskClient.queryMyList({
instID: "002N000000VwBrSDISbQ",
rootID: "002N000000VBjj8I66gC",
options: {
fields: ["assignee", "assigneeID", "assigneeType", "assigneeName", "name", "state", "rootID", "owner"],
}
})
console.log(tasks)
返回匹配的任务列表
查询suspended状态的bpm任务
Optional
queryCondition: QueryCondition查询条件,可以全部为空或部分为空
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let res = taskClient.querySuspendList({
creator: "002I000000VBjYt2OCYK",
owner: "002I000000VBjYt2OCYK"
})
console.log(res)
查询返回的任务列表
结束任务
任务实例ID
可以指定任务结果状态,如果为空字符串,任务状态将默认置为"complete"
可以设置BPM任务的变量,如果为空Map{}则不修改变量值
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let res = taskClient.rollbackSpecifiedTask(
"002N000000VBk5qqWi1I",
"",
{}
)
console.log(res)
任务状态信息
设置BPM任务中定义变量的值
任务实例ID
参数key-value键值对,注意设置的变量名是BPM定义过的变量
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
taskClient.setVars("002N000000VwBrSDISbQ", {
"foo": "aaa",
"bar": "bbb"
})
终止任务
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
taskClient.terminate("bpId","bp is end")
任务状态信息
让系统将任务转移给他人
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
taskClient.transfer("bpId","userId","")
任务状态信息
更新BPM任务的评论
任务实例ID
评论实例ID
评论信息
import * as bp from 'bp'
let taskClient = bp.newTaskClient()
let res = taskClient.updateComment("taskInsId","commentId","comment")
为BPM任务添加文件附件信息