informat.bpmn Workflow Operations
Overview
Use informat.bpmn to query and create workflow instances and workflow tasks
processEngine
ProcessEngine is the core component of the Flowable process engine, responsible for managing process definitions, process instances, tasks, variables, events, and other aspects, providing users with a complete set of process management interfaces.
informat.bpmn.processEngine();Tip
This interface requires the license to include the System Function Call module
Example
// Set workflow task assignee
let processEngine = informat.bpmn.processEngine();
let taskService = processEngine.getTaskService();
taskService.setAssignee("dcc50d2e-0601-11ef-92a9-0e6cd3d9f023", "zhangsan");getBpmnProcessDefineList
Query workflow definition list
informat.bpmn.getBpmnProcessDefineList(module, query);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| query | InformatBpmnProcessQuery | Query conditions |
Return Value
The return value is a list of workflow definitions that meet the conditions, of type Array<BpmnProcess>;
Example
informat.bpmn.getBpmnProcessDefineList("flow", {
accountId: "zhangsan",
name: "Leave",
});[
{
"color": "c2",
"createTime": 1692861587735,
"icon": "store",
"id": "s615lvvta7l7",
"key": "leave",
"name": "Leave Process",
"remark": "",
"rowNumber": 1,
"updateTime": 1692861587735
}
]isMultiInstanceActivity
Determine if a node is a multi-instance node
informat.bpmn.isMultiInstanceActivity(procDefId, activityId);Parameters
| Parameter | Type | Description |
|---|---|---|
| procDefId | String | Process definition ID |
| activityId | String | Node ID |
Return Value
Return value Boolean
Example
informat.bpmn.isMultiInstanceActivity("process_uotiqkw6kk5d:22:56aa67bf-8b65-11ee-adfa-a6c0b0be7615", "Activity_121ubs9");truequeryInstanceList
Query workflow instance list
informat.bpmn.queryInstanceList(module, query);Parameters
| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| query | BpmnInstanceQuery | Query conditions |
Return Value
The return value is a list of workflow instances that meet the conditions, of type Array<BpmnInstance>;
Example - Query workflow instances by status
informat.bpmn.queryInstanceList("flow", {
pageIndex: 1,
pageSize: 10,
processDefineId: "leave",
status: "doing",
});[
{
"active": true,
"businessKey": "s615lvvta7l7",
"id": "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a",
"isActive": true,
"name": "Leave",
"procDefId": "process_idy5gsmor6ym:78:3663d930-ca24-11ed-b464-9604767b6c5e",
"procDefName": "Leave Process",
"procInstId": "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a",
"startTime": 1679649411594,
"startUserAvatar": "pic15.png",
"startUserId": "zhangsan",
"startUserName": "jion",
"taskCount": 0,
"tenantId": "g09aj7cus3d8s_croe0zft168y3_pwlfcrmbm46t"
}
]Example - Query workflow instances by data table record ID
informat.bpmn.queryInstanceList("flow", {
pageIndex: 1,
pageSize: 10,
status: "doing",
processDefineId: "leave",
varList: [{ name: "form_recordId", value: "vem8fxf4ooztl" }],
});[
{
"active": true,
"businessKey": "s615lvvta7l7",
"id": "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a",
"isActive": true,
"name": "Leave",
"procDefId": "process_idy5gsmor6ym:78:3663d930-ca24-11ed-b464-9604767b6c5e",
"procDefName": "Leave Process",
"procInstId": "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a",
"startTime": 1679649411594,
"startUserAvatar": "pic15.png",
"startUserId": "zhangsan",
"startUserName": "mr.zhang",
"taskCount": 0,
"tenantId": "g09aj7cus3d8s_croe0zft168y3_pwlfcrmbm46t"
}
]addComment
Add comment
informat.bpmn.addComment(moduleId, taskId, msg);Parameters
| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Task ID |
| msg | String | Comment content |
Return Value
The return value is the ID record of the newly added comment
Example
informat.bpmn.addComment("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "The weather is really nice today.");c5cyqgj06avp0Note
The message format stored in the database is:
{
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "The weather is really nice today."
}
]
}
]
}deleteComment
Delete comment
informat.bpmn.deleteComment(moduleId, taskId, id);Parameters
| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Task ID |
| id | String | Comment ID |
Return Value
Number of comments deleted
Example
informat.bpmn.deleteComment("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "b8sy2k46dfckh");1queryCommentListCount
Query workflow task comment list total count
informat.bpmn.queryCommentListCount(moduleId, query);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| query | BpmnCommentQuery | Query conditions |
Return Value
The return value is the total count of comments that meet the conditions, of type Integer
Example
informat.bpmn.queryCommentListCount("flow", {
procInstId: "1554f565-3e48-11ed-8392-a210f8dfa819",
taskId: "bf5e798f-3f1b-11ed-b5f4-a210f8dfa819",
});1queryCommentList
Query workflow comment list
informat.bpmn.queryCommentList(module, query);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| query | BpmnCommentQuery | Query conditions |
Return Value
The return value is a list of workflow comments that meet the conditions, of type Array<BpmnComent>;
Example
informat.bpmn.queryCommentList("flow", {
pageIndex: 1,
pageSize: 10,
moduleId: "flow",
procInstId: "1554f565-3e48-11ed-8392-a210f8dfa819",
taskId: "bf5e798f-3f1b-11ed-b5f4-a210f8dfa819",
});[
{
"userId": "liutao",
"procInstId": "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a",
"taskId": "15571850-3e48-11ed-8392-a210f8dfa819",
"startTime": 1664271502000,
"message": "{\"type\":\"doc\",\"content\":[{\"type\":\"paragraph\",\"content\":[{\"type\":\"text\",\"text\":\"consent\"}]}]}"
}
]queryInstanceListCount
Query workflow instance list total count
informat.bpmn.queryInstanceListCount(moduleId, query);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| query | BpmnInstanceQuery | Query conditions |
Return Value
The return value is the total count of workflow instances that meet the conditions, of type Integer
Example
informat.bpmn.queryInstanceListCount("flow", {
moduleId: "flow",
processDefineId: "insertUser",
status: "doing",
});1queryInstanceById
Query workflow instance
informat.bpmn.queryInstanceById(moduleId, instanceId);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| instanceId | String | Process instance ID |
Return Value
The return value is the instance that meets the conditions, of type BpmnInstance
Example
informat.bpmn.queryInstanceById("flow", "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a");{
"active": true,
"businessKey": "s615lvvta7l7",
"id": "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a",
"isActive": true,
"name": "Leave",
"procDefId": "process_idy5gsmor6ym:78:3663d930-ca24-11ed-b464-9604767b6c5e",
"procDefName": "Leave Process",
"procInstId": "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a",
"startTime": 1679649411594,
"startUserAvatar": "pic15.png",
"startUserId": "zhangsan",
"startUserName": "zhangsan",
"taskCount": 0,
"tenantId": "g09aj7cus3d8s_croe0zft168y3_pwlfcrmbm46t"
}queryTaskList
Query workflow task list
informat.bpmn.queryTaskList(moduleId, query);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| query | BpmnTaskQuery | Query conditions |
Return Value
The return value is the list of tasks that meet the conditions, of type Array<BpmnTask>;
Example
informat.bpmn.queryTaskList("flow", {
pageIndex: 1,
pageSize: 10,
procInstId: "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a",
status: "doing",
});[
{
"assignee": "zhangsan",
"assigneeAvatar": "c4b936e826fe45b38e1b4072c79a7a79.jpg",
"assigneeName": "mr.zhang",
"duration": 0,
"executionId": "9cdf8124-ca24-11ed-8bc0-be634eacf49a",
"id": "9cf63d7a-ca24-11ed-8bc0-be634eacf49a",
"name": "Department Manager Approval",
"procDefId": "process_idy5gsmor6ym:78:3663d930-ca24-11ed-b464-9604767b6c5e",
"procDefName": "Leave Process",
"procInstId": "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a",
"procInstName": "Leave",
"startTime": 1679649411860,
"startUserAvatar": "pic15.png",
"startUserId": "zhangsan",
"startUserName": "zhangsan",
"taskDefKey": "Activity_0ofrc9c",
"tenantId": "g09aj7cus3d8s_croe0zft168y3_pwlfcrmbm46t"
}
]queryTaskListCount
Query workflow task list total count
informat.bpmn.queryTaskListCount(moduleId, query);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| query | BpmnTaskQuery | Query conditions |
Return Value
The return value is the total count of tasks that meet the conditions, of type Integer
Example
informat.bpmn.queryTaskListCount("flow", {
procInstId: "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a",
status: "doing",
});1queryTaskById
Query workflow task
informat.bpmn.queryTaskById(moduleId, taskId);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Task ID |
Return Value
The return value is the task that meets the conditions, of type BpmnTask
Example
informat.bpmn.queryTaskById("flow", "9cf63d7a-ca24-11ed-8bc0-be634eacf49a");{
"assignee": "zhangsan",
"assigneeAvatar": "c4b936e826fe45b38e1b4072c79a7a79.jpg",
"assigneeName": "zhangsan",
"duration": 0,
"executionId": "9cdf8124-ca24-11ed-8bc0-be634eacf49a",
"id": "9cf63d7a-ca24-11ed-8bc0-be634eacf49a",
"name": "Department Manager Approval",
"procDefId": "process_idy5gsmor6ym:78:3663d930-ca24-11ed-b464-9604767b6c5e",
"procDefName": "Leave Process",
"procInstId": "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a",
"procInstName": "Leave",
"startTime": 1679649411860,
"startUserAvatar": "pic15.png",
"startUserId": "zhangsan",
"startUserName": "zhangsan",
"taskDefKey": "Activity_0ofrc9c",
"tenantId": "g09aj7cus3d8s_croe0zft168y3_pwlfcrmbm46t"
}setInstanceVar
Set workflow instance variable
informat.bpmn.setInstanceVar(moduleId, instanceId, name, value);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Workflow task ID |
| name | String | Variable name |
| value | Object | Variable value |
Example
informat.bpmn.setInstanceVar("flow", "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a", "userName", "mr.zhang");getInstanceVar
Get workflow instance variable
informat.bpmn.getInstanceVar(moduleId, instanceId, name);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| instanceId | String | Process instance ID |
| name | String | Variable name |
Return Value
Type Object, returns the variable value
Example
informat.bpmn.getInstanceVar("flow", "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a", "userName");mr.zhanggetInstanceVars
Get all workflow instance variables
informat.bpmn.getInstanceVars(moduleId, instanceId);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| instanceId | String | Process instance ID |
Return Value
Type Object, returns all variable key-value pairs
Example
informat.bpmn.getInstanceVars("flow", "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a");{
"reason": "I have a meeting in the morning.",
"instanceId": "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a",
"form": {
"approver": {
"avatar": "c4b936e826fe45b38e1b4072c79a7a79.jpg",
"id": "zhangsan",
"name": "mr.zhang"
},
"id": "isvuoz412f1ve",
"title": "333",
"day": 5,
"status": "1"
},
"initiator": "zhangsan",
"project": "Project Management",
"taskName": "Task",
"userName": "mr.zhang",
"taskStatus": "Doing"
}setInstanceLocalVar
Set workflow instance local variable
informat.bpmn.setInstanceLocalVar(moduleId, instanceId, name, value);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| instanceId | String | Process instance ID |
| name | String | Variable name |
| value | Object | Variable value |
Example
informat.bpmn.setInstanceLocalVar("flow", "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a", "project", "Project Management");getInstanceLocalVar
Get workflow instance local variable
informat.bpmn.getInstanceLocalVar(moduleId, instanceId, name);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| instanceId | String | Process instance ID |
| name | String | Variable name |
Return Value
Type Object, returns the variable value
Example
informat.bpmn.getInstanceLocalVar("flow", "a8bbc752-24af-11ef-bcd1-a6c0b0be7615", "project");Project ManagementsetTaskVar
Set workflow task variable
informat.bpmn.setTaskVar(moduleId, taskId, name, value);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Workflow task ID |
| name | String | Variable name |
| value | Object | Variable value |
Example
informat.bpmn.setTaskVar("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "taskName", "task");getTaskVar
Get workflow task variable
informat.bpmn.getTaskVar(moduleId, taskId, name);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Workflow task ID |
| name | String | Variable name |
Return Value
Type Object, returns the variable value
Example
informat.bpmn.getTaskVar("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "taskName");taskgetTaskVars
Get workflow task variables
informat.bpmn.getTaskVars(moduleId, taskId, localVariable);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Workflow task ID |
| localVariable | Boolean | Whether it is a local variable |
Return Value
Type Object, returns all variable key-value pairs
Example
informat.bpmn.getTaskVars("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", false);{
"name": "mr.zhang"
}setTaskLocalVar
Set workflow task local variable
informat.bpmn.setTaskLocalVar(moduleId, taskId, name, value);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Workflow task ID |
| name | String | Variable name |
| value | Object | Variable value |
Example
informat.bpmn.setTaskLocalVar("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "taskStatus", "In progress");Notes
When the process task node enables Store form data as task variables (task variables are only visible to the current task), the form information for setting process task variables requires the variable name to use ${form}_task, where ${form} is the form identifier
getTaskLocalVar
Get process task local variable
informat.bpmn.getTaskLocalVar(moduleId, taskId, name);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| instanceId | String | Process instance ID |
| name | String | Variable name |
Return Value
Type Object, returns the variable value
Example
informat.bpmn.getTaskLocalVar("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "taskStatus");In progressNotes
When the process task node enables Store form data as task variables (task variables are only visible to the current task), the form information for getting process task variables requires the variable name to use ${form}_task, where ${form} is the form identifier
createInstance
Create workflow instance
informat.bpmn.createInstance(moduleId, processDefineId, startUserId, form, vars);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| processDefineId | String | Workflow definition identifier |
| startUserId | String | Initiator account ID |
| form | Object | Data table record |
| vars | Object | Startup variables |
Return Value
Type String, returns the process instance ID
Example
let form = {
level: 1,
sex: "man",
idNo: "450323111111111111",
post: "last",
biographicalNote: {
id: "qqc5uxend8j5zg8annd6w.crx",
md5: "0b3df75922df4b125309577c93645d0b",
name: "JSON-handle_0.6.1.crx",
path: "do5u69j9ff3ap/jcn3qaf48z6dh/qqc5uxend8j5zg8annd6w.crx",
size: 197147,
},
name: "mr. zhang",
status: "atInterview",
};
let vars = {
startTime: new Date(),
};
informat.bpmn.createInstance("flow", "insertUser", "yvkc2kwpy3xzr", form, vars);3cc15cd9-8b9f-11ee-bbf4-a6c0b0be7615setTaskAssignee
Set task assignee
informat.bpmn.setTaskAssignee(moduleId, taskId, userId);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Process task ID |
| userId | String | Assignee account ID |
Example
informat.bpmn.setTaskAssignee("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "yvkc2kwpy3xzr");setTaskOwner
Set task owner
informat.bpmn.setTaskOwner(moduleId, taskId, userId);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Process task ID |
| userId | String | Owner account ID |
Example
informat.bpmn.setTaskOwner("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "yvkc2kwpy3xzr");claimTask
Claim task (assign the task responsibility to a specific participant)
INFO
If the task has already been claimed, it cannot be assigned.
informat.bpmn.claimTask(moduleId, taskId, userId);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Process task ID |
| userId | String | Assignee account ID |
Example
informat.bpmn.claimTask("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "zhangsan");unclaimTask
Cancel task assignment
informat.bpmn.unclaimTask(moduleId, taskId);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Process task ID |
Example
informat.bpmn.unclaimTask("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615");transferTask
Transfer task (transfer task ownership and processing rights from current participant to another participant)
informat.bpmn.transferTask(moduleId, taskId, userId);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Process task ID |
| userId | String | Assignee account ID |
Example
informat.bpmn.transferTask("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "zhangsan");delegateTask
Delegate task (transfer task responsibility from current participant to another participant)
informat.bpmn.delegateTask(moduleId, taskId, userId, autoDelegate);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Process task ID |
| userId | String | Assignee account ID |
| autoDelegate | Boolean | Whether to automatically delegate |
Notes
It should be noted that when autoDelegate is true, you need to ensure that automatic delegation rules have been defined to ensure that tasks can be correctly delegated to appropriate participants. At the same time, you need to ensure that automatic delegation does not cause infinite loops or other issues to ensure the stability and reliability of the process.
Example
informat.bpmn.delegateTask("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "zhangsan", true);getIdentityLinksForTask
Get the list of identity links associated with the task
informat.bpmn.getIdentityLinksForTask(moduleId, taskId);INFO
Used to query participants or candidates related to the task. By querying the identity link list, you can determine which users or roles are associated with the task and perform corresponding authorization and management of the task.
| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Process task ID |
Return Value
Type Array<BpmnIdentityLink>;
Example
informat.bpmn.getIdentityLinksForTask("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615");[
{
"groupId": "admin",
"id": "662e2b7b-e8e5-11ed-9724-9604767b6c5e",
"taskId": "a8c27e21-24af-11ef-bcd1-a6c0b0be7615",
"type": "candidate"
},
{
"taskId": "a8c27e21-24af-11ef-bcd1-a6c0b0be7615",
"type": "owner",
"userId": "zhangsan"
}
]addTaskCandidateRole
Add a candidate role to the task
informat.bpmn.addTaskCandidateRole(moduleId, taskId, roleId);TIP
Candidate roles refer to application roles that can participate in task processing, such as "developers", "testers", etc.
| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Process task ID |
| roleId | String | Application role ID |
Example
informat.bpmn.addTaskCandidateRole("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "tester");deleteTaskCandidateRole
Delete task candidate role.
informat.bpmn.deleteTaskCandidateRole(moduleId, taskId, roleId);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Process task ID |
| roleId | String | Application role ID |
Example
informat.bpmn.deleteTaskCandidateRole("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "tester");addTaskCandidateUser
Add a candidate user to the task
informat.bpmn.addTaskCandidateUser(moduleId, taskId, userId);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Process task ID |
| userId | String | Candidate user ID |
Example
informat.bpmn.addTaskCandidateUser("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "zhangsan");deleteTaskCandidateUser
Delete task candidate user
informat.bpmn.deleteTaskCandidateUser(moduleId, taskId, userId);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Process task ID |
| userId | String | Candidate user ID |
Example
informat.bpmn.deleteTaskCandidateUser("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "zhangsan");completeTask
Complete task
informat.bpmn.completeTask(moduleId, taskId, variables);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Process task ID |
| variables | Object | Output data and process variables to be passed to subsequent steps when completing the task |
Example
informat.bpmn.completeTask("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", null);moveToActivity
Move the process node from its current position to another node
informat.bpmn.moveToActivity(moduleId, taskId, targetActivityId);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| taskId | String | Process task ID |
| targetActivityId | String | Target node ID (can be found in workflow "Set Flow Chart >> Select Node >> Basic Information") |
Example
informat.bpmn.moveToActivity("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "Activity_0y15knc");revokeInstance
Revoke process instance
informat.bpmn.revokeInstance(moduleId, instanceId, reason);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| instanceId | String | Process instance ID |
| reason | String | Revocation reason |
Example
informat.bpmn.revokeInstance("flow", "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a", "Cancel Process");deleteInstance
Delete process instance
informat.bpmn.deleteInstance(moduleId, instanceId, reason);Notes
When a process instance is deleted, the process will be terminated and all data and status information related to the process instance will be cleared.
| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| instanceId | String | Process instance ID |
| reason | String | Deletion reason |
Example
informat.bpmn.deleteInstance("flow", "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a", "Delete Process");sendMessage
Send a message to a process instance or execution instance
informat.bpmn.sendMessage(moduleId, instanceId, messageName);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| instanceId | String | Process instance ID |
| messageName | String | Message name |
Example
informat.bpmn.sendMessage("flow", "9cd49233-24b2-11ef-bcd1-a6c0b0be7615", "msg1");sendSignal
Send a signal to a process instance or execution instance
informat.bpmn.sendSignal(moduleId, instanceId, signalName);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| instanceId | String | Process instance ID |
| signalName | String | Signal name |
Example
informat.bpmn.sendSignal("flow", "9cd49233-24b2-11ef-bcd1-a6c0b0be7615", "signal1");trigger
Trigger a waiting process instance
informat.bpmn.trigger(moduleId, instanceId, activityId);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| instanceId | String | Process instance ID |
| activityId | String | Intermediate event ID (can be viewed in the basic information of process design node) |
Example
informat.bpmn.trigger("flow", "9cd49233-24b2-11ef-bcd1-a6c0b0be7615", "Activity_0jl4nsq");getProcessDefineXml
Get the XML content of workflow definition
informat.bpmn.getProcessDefineXml(moduleId, procDefId);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| procDefId | String | Process definition ID |
Example
informat.bpmn.getProcessDefineXml("flow", "process_idy5gsmor6ym:100:ae4923cb-6d64-11ee-a8da-eed108c67451");<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:flowable="http://flowable.org/bpmn"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:informat="http://informat.cn/schema/bpmn/ip"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" targetNamespace="Examples">
<process id="process_uotiqkw6kk5d" name="Project Change Control Process" isExecutable="true"
...
>
<message id="message" name="msg"/>
<bpmndi:BPMNDiagram id="BPMNDiagram_1"
...
>
</definitions>generateProcessDiagram
Generate workflow diagram image
informat.bpmn.generateProcessDiagram(moduleId, procDefId, config);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| procDefId | String | Process definition ID |
| config | BpmnProcessDiagramConfig | Configuration information |
Example
let config = {
activityFontName: "shong",
labelFontName: "shong",
annotationFontName: "shong",
highLightedActivities: ["StartEvent_1", "Activity_0ofrc9c", "Activity_0i7rzdo"],
highLightedFlows: ["Flow_061bx1o", "Flow_0l1tmev", "Flow_0n92u98"],
scaleFactor: 1.0,
drawSequenceFlowNameWithNoLabelDI: false,
};
let procDefId = "process_idy5gsmor6ym:100:ae4923cb-6d64-11ee-a8da-eed108c67451";
let base64Img = informat.bpmn.generateProcessDiagram("flow", procDefId, config);
console.log("base64Img", base64Img);iVBORw0KGgoAAAANSUhEUgAAByYAAAImCAYAAAAWme0EAACAAElEQVR4XuzdCZxkVX33/8MmIuCCgiAiAwKi4...setProcessInstanceName
Set workflow instance name
informat.bpmn.setProcessInstanceName(moduleId, instanceId, name);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module ID |
| instanceId | String | Workflow instance ID |
| name | String | Instance name |
Example
informat.bpmn.setProcessInstanceName("flow", "a8bbc752-24af-11ef-bcd1-a6c0b0be7615", "new process instance name");addMultiInstanceExecution
Add process execution for multi-instance
informat.bpmn.addMultiInstanceExecution(moduleId, activityId, parentExecutionId, variables);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| activityId | String | Process node ID |
| parentExecutionId | String | Parent process execution ID, can be process instance ID |
| variables | Object | Process execution variables |
Return Value
Returns the newly added process execution ID, type is String
Example
// Add an approver for Node A (lisi)
var variables = {
assignee: "yvkc2kwpy3xzr", //“assignee” is the variable name entered in the flow-node handler field; adjust it as required for your specific situation.
};
informat.bpmn.addMultiInstanceExecution("flow", "Activity_0a866jw", "fa3d9fde-93ff-11ee-b865-eed108c67451", variables);c263580f-9402-11ee-b865-eed108c67451Notes
This interface is only valid for multi-instance nodes
deleteMultiInstanceExecution
Delete process execution for multi-instance
informat.bpmn.deleteMultiInstanceExecution(moduleId, executionId, executionIsCompleted);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Workflow module identifier |
| executionId | String | Process node ID |
| executionIsCompleted | Boolean | Whether to mark process execution as completed |
Example
// Remove an approver for Node A
informat.bpmn.deleteMultiInstanceExecution("flow", "a8be867d-24af-11ef-bcd1-a6c0b0be7615", true);Notes
This interface is only valid for multi-instance nodes
addBpmnTaskCcList
This method adds CC recipients to the BPMN task CC table
informat.bpmn.addBpmnTaskCcList(taskId, copyUserList);| Parameter | Type | Description |
|---|---|---|
taskId | String | ID of the BPMN task. |
copyUserList | Array<String> | List of user IDs to add as CC recipients. |
Example
informat.bpmn.addBpmnTaskCcList("a8c27e21-24af-11ef-bcd1-a6c0b0be7615", ["yvkc2kwpy3xzr"]);deleteBpmnTaskCc
This method removes a CC recipient from the BPMN task CC table.
informat.bpmn.deleteBpmnTaskCc(taskId, copyUserId);| Parameter | Type | Description |
|---|---|---|
taskId | String | ID of the BPMN task. |
copyUserId | String | User ID to remove from the CC list. |
Example
informat.bpmn.deleteBpmnTaskCc("3cc8fe05-8b9f-11ee-bbf4-a6c0b0be7615", "zhangsan");queryBpmnTaskCcList
Retrieves a list of BPMN task CC recipients based on the given query.
informat.bpmn.queryBpmnTaskCcList(query);| Parameter | Type | Description |
|---|---|---|
query | Query | Query object for filtering the BPMN task CC table. |
Filterable Fields
| Parameter | Type | Description |
|---|---|---|
taskId | String | Task ID |
copyUserId | String | CC User |
Example
informat.bpmn.queryBpmnTaskCcList({
pageIndex: 1,
pageSize: 10,
filter: {
conditionList: [{ fieldId: "taskId", opt: "eq", value: "taskId" }],
},
});[
{
"copyUserAvatar": "pic7.png",
"copyUserId": "xwi9jogl4fcx4",
"copyUserName": "zhangsan",
"id": "ifpno8kcp60w0",
"taskId": "fb8ff623-f7ae-11ee-b253-a6c0b0be7615"
},
{
"copyUserAvatar": "383e58e051c849e9bff4f26f432c0764.jpg",
"copyUserId": "nx8hcjsq4xk8z",
"copyUserName": "lisi",
"id": "fyyew216vjagc",
"taskId": "396ebfdd-1770-11ef-b056-a6c0b0be7615"
}
]queryBpmnTaskCcListCount
Returns the count of the BPMN task CC recipient table based on the given filter.
informat.bpmn.queryBpmnTaskCcListCount(filter);| Parameter | Type | Description |
|---|---|---|
filter | Filter | Filter object for counting the BPMN task CC recipient table. |
Example
informat.bpmn.queryBpmnTaskCcListCount({
conditionList: [{ fieldId: "taskId", opt: "eq", value: "taskId" }],
});2getHistoryTaskVariables
Get process history task variables
informat.bpmn.getHistoryTaskVariables(taskId);| Parameter | Type | Description |
|---|---|---|
taskId | String | Process task ID |
Return Value
Type Object, returns all variable values
Example
informat.bpmn.getHistoryTaskVariables("9cf63d7a-ca24-11ed-8bc0-be634eacf49a");getHistoryTaskVariable
Get process history task variable
informat.bpmn.getHistoryTaskVariable(taskId, variableName);| Parameter | Type | Description |
|---|---|---|
taskId | String | Process task ID |
variableName | String | Variable name |
Return Value
Type Object, returns the variable value
Example
informat.bpmn.getHistoryTaskVariable("9cf63d7a-ca24-11ed-8bc0-be634eacf49a", "form");deleteTasks
Delete workflow task list
informat.bpmn.deleteTasks(moduleId, taskIds, deleteReason, cascade);| Parameter | Type | Description |
|---|---|---|
moduleId | String | Module identifier |
taskIds | Array<String> | Task ID list |
deleteReason | String | Delete reason |
cascade | Boolean | Whether to cascade delete |
Example
informat.bpmn.deleteTasks("flow", ["9cf63d7a-ca24-11ed-8bc0-be634eacf49a"], "testDel", true);getStartSetting
Get process definition start settings
informat.bpmn.getStartSetting(moduleKey, defineId);| Parameter | Type | Description |
|---|---|---|
| moduleKey | String | Module identifier |
| defineId | String | Process definition ID |
Return Value
Return value type is BpmnStartSetting, the process start setting information
Example
informat.bpmn.getStartSetting("flow", "h141dq1w5ijpf");{
"activityUserList": [],
"enableStartForm": true,
"formSetting": {
"completeSetVarList": [],
"enableShowProcessInfo": false,
"formDesignerFieldSettingList": [],
"id": "form",
"localVariable": false,
"tableFieldSettingList": [
{
"editable": true,
"id": "y68l84iidbr9l",
"visible": true
},
{
"editable": true,
"id": "vn4v208530vfj",
"visible": true
},
{
"editable": true,
"id": "gjkb3rq7q44wu",
"visible": true
},
{
"editable": true,
"id": "ceumuggdjze5i",
"visible": true
},
{
"editable": true,
"id": "t9416rt5uv818",
"visible": true
},
{
"editable": true,
"id": "a3rumke2j97m6",
"visible": true
}
],
"tableId": "skwl7tkdsh650",
"toolBarButtonList": []
},
"instanceToolbarButtonList": [],
"startFormToolbarButtonList": [],
"startVarList": []
}getTaskSetting
Get task setting
informat.bpmn.getTaskSetting(procDefineId, taskDefKey);| Parameter | Type | Description |
|---|---|---|
| procDefineId | String | Process definition ID |
| taskDefKey | String | Task definition ID |
Return Value
Type BpmnTaskSetting
Example
informat.bpmn.getTaskSetting("process_swf2089hng2j:1:c0cc319f-7a59-11ef-bb07-0242d99c1a6f", "Activity_1nky9zn");{
"autocompleteNodeIds": [],
"enableAutocomplete": false,
"formSetting": {
"completeSetVarList": [],
"enableShowProcessInfo": false,
"formDesignerFieldSettingList": [],
"formType": "Form",
"id": "form",
"localVariable": false,
"tableFieldSettingList": [
{
"editable": false,
"id": "y68l84iidbr9l",
"visible": true
},
{
"editable": false,
"id": "vn4v208530vfj",
"visible": true
},
{
"editable": false,
"id": "gjkb3rq7q44wu",
"visible": true
},
{
"editable": false,
"id": "ceumuggdjze5i",
"visible": true
},
{
"editable": false,
"id": "t9416rt5uv818",
"visible": true
},
{
"editable": false,
"id": "a3rumke2j97m6",
"visible": true
}
],
"tableId": "skwl7tkdsh650",
"toolBarButtonList": [
{
"action": "TaskComplete",
"actionSetting": {
"enableComment": false,
"bpmnModuleId": "b6qe23fkfwlux",
"taskIdExpression": "${task.id}",
"varList": [],
"valueList": [],
"tableId": "skwl7tkdsh650"
},
"buttonSetting": {
"enableConfirm": false,
"hideName": false,
"icon": "check-double",
"plain": false,
"round": false,
"type": "primary"
},
"children": [],
"controlType": "button",
"hideExpression": "${task.endTime != null || task.assignee != user.id}",
"id": "w7b5ah41xs1e",
"inputSetting": {
"width": 200
},
"isDirectory": false,
"labelSetting": {
"bold": false,
"fontSize": 13
},
"name": "Approve",
"selectSetting": {
"multiple": false,
"optionList": [],
"width": 200
},
"switchSetting": {
"type": "primary"
},
"visibleRoleList": []
},
{
"action": "TaskMoveToEnd",
"actionSetting": {
"enableComment": false,
"bpmnModuleId": "b6qe23fkfwlux",
"taskIdExpression": "${task.id}",
"valueList": [],
"tableId": "skwl7tkdsh650"
},
"buttonSetting": {
"completeExpression": "Process Termination Successful",
"confirmMessageExpression": "Are you sure you want to terminate this process?",
"enableConfirm": true,
"hideName": false,
"icon": "stop-circle",
"plain": false,
"round": false,
"type": "danger"
},
"children": [],
"controlType": "button",
"hideExpression": "${task.endTime != null || task.assignee != user.id}",
"id": "mum6gdf67m9q",
"inputSetting": {
"width": 200
},
"isDirectory": false,
"labelSetting": {
"bold": false,
"fontSize": 13
},
"name": "Terminate",
"selectSetting": {
"multiple": false,
"optionList": [],
"width": 200
},
"switchSetting": {
"type": "primary"
},
"visibleRoleList": []
}
]
},
"userAction": "Form"
}
