Skip to content

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.

javascript
informat.bpmn.processEngine();

Tip

This interface requires the license to include the System Function Call module

Refer to ProcessEngine Documentation

Example

javascript
// 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

javascript
informat.bpmn.getBpmnProcessDefineList(module, query);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
queryInformatBpmnProcessQueryQuery conditions

Return Value

The return value is a list of workflow definitions that meet the conditions, of type Array<BpmnProcess>;

Example

javascript
informat.bpmn.getBpmnProcessDefineList("flow", {
  accountId: "zhangsan",
  name: "Leave",
});
json
[
  {
    "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

javascript
informat.bpmn.isMultiInstanceActivity(procDefId, activityId);

Parameters

ParameterTypeDescription
procDefIdStringProcess definition ID
activityIdStringNode ID

Return Value

Return value Boolean

Example

javascript
informat.bpmn.isMultiInstanceActivity("process_uotiqkw6kk5d:22:56aa67bf-8b65-11ee-adfa-a6c0b0be7615", "Activity_121ubs9");
json
true

queryInstanceList

Query workflow instance list

javascript
informat.bpmn.queryInstanceList(module, query);

Parameters

ParameterTypeDescription
moduleIdStringWorkflow module identifier
queryBpmnInstanceQueryQuery 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

javascript
informat.bpmn.queryInstanceList("flow", {
  pageIndex: 1,
  pageSize: 10,
  processDefineId: "leave",
  status: "doing",
});
json
[
  {
    "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

javascript
informat.bpmn.queryInstanceList("flow", {
  pageIndex: 1,
  pageSize: 10,
  status: "doing",
  processDefineId: "leave",
  varList: [{ name: "form_recordId", value: "vem8fxf4ooztl" }],
});
json
[
  {
    "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

javascript
informat.bpmn.addComment(moduleId, taskId, msg);

Parameters

ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringTask ID
msgStringComment content

Return Value

The return value is the ID record of the newly added comment

Example

javascript
informat.bpmn.addComment("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "The weather is really nice today.");
text
c5cyqgj06avp0

Note

The message format stored in the database is:

json
{
  "type": "doc",
  "content": [
    {
      "type": "paragraph",
      "content": [
        {
          "type": "text",
          "text": "The weather is really nice today."
        }
      ]
    }
  ]
}

deleteComment

Delete comment

javascript
informat.bpmn.deleteComment(moduleId, taskId, id);

Parameters

ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringTask ID
idStringComment ID

Return Value

Number of comments deleted

Example

javascript
informat.bpmn.deleteComment("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "b8sy2k46dfckh");
text
1

queryCommentListCount

Query workflow task comment list total count

javascript
informat.bpmn.queryCommentListCount(moduleId, query);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
queryBpmnCommentQueryQuery conditions

Return Value

The return value is the total count of comments that meet the conditions, of type Integer

Example

javascript
informat.bpmn.queryCommentListCount("flow", {
  procInstId: "1554f565-3e48-11ed-8392-a210f8dfa819",
  taskId: "bf5e798f-3f1b-11ed-b5f4-a210f8dfa819",
});
text
1

queryCommentList

Query workflow comment list

javascript
informat.bpmn.queryCommentList(module, query);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
queryBpmnCommentQueryQuery conditions

Return Value

The return value is a list of workflow comments that meet the conditions, of type Array<BpmnComent>;

Example

javascript
informat.bpmn.queryCommentList("flow", {
  pageIndex: 1,
  pageSize: 10,
  moduleId: "flow",
  procInstId: "1554f565-3e48-11ed-8392-a210f8dfa819",
  taskId: "bf5e798f-3f1b-11ed-b5f4-a210f8dfa819",
});
json
[
  {
    "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

javascript
informat.bpmn.queryInstanceListCount(moduleId, query);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
queryBpmnInstanceQueryQuery conditions

Return Value

The return value is the total count of workflow instances that meet the conditions, of type Integer

Example

javascript
informat.bpmn.queryInstanceListCount("flow", {
  moduleId: "flow",
  processDefineId: "insertUser",
  status: "doing",
});
text
1

queryInstanceById

Query workflow instance

javascript
informat.bpmn.queryInstanceById(moduleId, instanceId);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
instanceIdStringProcess instance ID

Return Value

The return value is the instance that meets the conditions, of type BpmnInstance

Example

javascript
informat.bpmn.queryInstanceById("flow", "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a");
json
{
  "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

javascript
informat.bpmn.queryTaskList(moduleId, query);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
queryBpmnTaskQueryQuery conditions

Return Value

The return value is the list of tasks that meet the conditions, of type Array<BpmnTask>;

Example

javascript
informat.bpmn.queryTaskList("flow", {
  pageIndex: 1,
  pageSize: 10,
  procInstId: "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a",
  status: "doing",
});
json
[
  {
    "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

javascript
informat.bpmn.queryTaskListCount(moduleId, query);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
queryBpmnTaskQueryQuery conditions

Return Value

The return value is the total count of tasks that meet the conditions, of type Integer

Example

javascript
informat.bpmn.queryTaskListCount("flow", {
  procInstId: "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a",
  status: "doing",
});
text
1

queryTaskById

Query workflow task

javascript
informat.bpmn.queryTaskById(moduleId, taskId);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringTask ID

Return Value

The return value is the task that meets the conditions, of type BpmnTask

Example

javascript
informat.bpmn.queryTaskById("flow", "9cf63d7a-ca24-11ed-8bc0-be634eacf49a");
json
{
  "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

javascript
informat.bpmn.setInstanceVar(moduleId, instanceId, name, value);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringWorkflow task ID
nameStringVariable name
valueObjectVariable value

Example

javascript
informat.bpmn.setInstanceVar("flow", "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a", "userName", "mr.zhang");

getInstanceVar

Get workflow instance variable

javascript
informat.bpmn.getInstanceVar(moduleId, instanceId, name);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
instanceIdStringProcess instance ID
nameStringVariable name

Return Value

Type Object, returns the variable value

Example

javascript
informat.bpmn.getInstanceVar("flow", "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a", "userName");
text
mr.zhang

getInstanceVars

Get all workflow instance variables

javascript
informat.bpmn.getInstanceVars(moduleId, instanceId);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
instanceIdStringProcess instance ID

Return Value

Type Object, returns all variable key-value pairs

Example

javascript
informat.bpmn.getInstanceVars("flow", "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a");
json
{
  "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

javascript
informat.bpmn.setInstanceLocalVar(moduleId, instanceId, name, value);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
instanceIdStringProcess instance ID
nameStringVariable name
valueObjectVariable value

Example

javascript
informat.bpmn.setInstanceLocalVar("flow", "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a", "project", "Project Management");

getInstanceLocalVar

Get workflow instance local variable

javascript
informat.bpmn.getInstanceLocalVar(moduleId, instanceId, name);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
instanceIdStringProcess instance ID
nameStringVariable name

Return Value

Type Object, returns the variable value

Example

javascript
informat.bpmn.getInstanceLocalVar("flow", "a8bbc752-24af-11ef-bcd1-a6c0b0be7615", "project");
text
Project Management

setTaskVar

Set workflow task variable

javascript
informat.bpmn.setTaskVar(moduleId, taskId, name, value);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringWorkflow task ID
nameStringVariable name
valueObjectVariable value

Example

javascript
informat.bpmn.setTaskVar("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "taskName", "task");

getTaskVar

Get workflow task variable

javascript
informat.bpmn.getTaskVar(moduleId, taskId, name);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringWorkflow task ID
nameStringVariable name

Return Value

Type Object, returns the variable value

Example

javascript
informat.bpmn.getTaskVar("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "taskName");
text
task

getTaskVars

Get workflow task variables

javascript
informat.bpmn.getTaskVars(moduleId, taskId, localVariable);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringWorkflow task ID
localVariableBooleanWhether it is a local variable

Return Value

Type Object, returns all variable key-value pairs

Example

javascript
informat.bpmn.getTaskVars("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", false);
json
{
  "name": "mr.zhang"
}

setTaskLocalVar

Set workflow task local variable

javascript
informat.bpmn.setTaskLocalVar(moduleId, taskId, name, value);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringWorkflow task ID
nameStringVariable name
valueObjectVariable value

Example

javascript
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

javascript
informat.bpmn.getTaskLocalVar(moduleId, taskId, name);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
instanceIdStringProcess instance ID
nameStringVariable name

Return Value

Type Object, returns the variable value

Example

javascript
informat.bpmn.getTaskLocalVar("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "taskStatus");
text
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 getting process task variables requires the variable name to use ${form}_task, where ${form} is the form identifier

createInstance

Create workflow instance

javascript
informat.bpmn.createInstance(moduleId, processDefineId, startUserId, form, vars);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
processDefineIdStringWorkflow definition identifier
startUserIdStringInitiator account ID
formObjectData table record
varsObjectStartup variables

Return Value

Type String, returns the process instance ID

Example

javascript
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);
text
3cc15cd9-8b9f-11ee-bbf4-a6c0b0be7615

setTaskAssignee

Set task assignee

javascript
informat.bpmn.setTaskAssignee(moduleId, taskId, userId);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringProcess task ID
userIdStringAssignee account ID

Example

javascript
informat.bpmn.setTaskAssignee("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "yvkc2kwpy3xzr");

setTaskOwner

Set task owner

javascript
informat.bpmn.setTaskOwner(moduleId, taskId, userId);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringProcess task ID
userIdStringOwner account ID

Example

javascript
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.

javascript
informat.bpmn.claimTask(moduleId, taskId, userId);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringProcess task ID
userIdStringAssignee account ID

Example

javascript
informat.bpmn.claimTask("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "zhangsan");

unclaimTask

Cancel task assignment

javascript
informat.bpmn.unclaimTask(moduleId, taskId);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringProcess task ID

Example

javascript
informat.bpmn.unclaimTask("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615");

transferTask

Transfer task (transfer task ownership and processing rights from current participant to another participant)

javascript
informat.bpmn.transferTask(moduleId, taskId, userId);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringProcess task ID
userIdStringAssignee account ID

Example

javascript
informat.bpmn.transferTask("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "zhangsan");

delegateTask

Delegate task (transfer task responsibility from current participant to another participant)

javascript
informat.bpmn.delegateTask(moduleId, taskId, userId, autoDelegate);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringProcess task ID
userIdStringAssignee account ID
autoDelegateBooleanWhether 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

javascript
informat.bpmn.delegateTask("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "zhangsan", true);

getIdentityLinksForTask

Get the list of identity links associated with the task

javascript
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.

ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringProcess task ID

Return Value

Type Array<BpmnIdentityLink>;

Example

javascript
informat.bpmn.getIdentityLinksForTask("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615");
json
[
  {
    "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

javascript
informat.bpmn.addTaskCandidateRole(moduleId, taskId, roleId);

TIP

Candidate roles refer to application roles that can participate in task processing, such as "developers", "testers", etc.

ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringProcess task ID
roleIdStringApplication role ID

Example

javascript
informat.bpmn.addTaskCandidateRole("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "tester");

deleteTaskCandidateRole

Delete task candidate role.

javascript
informat.bpmn.deleteTaskCandidateRole(moduleId, taskId, roleId);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringProcess task ID
roleIdStringApplication role ID

Example

javascript
informat.bpmn.deleteTaskCandidateRole("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "tester");

addTaskCandidateUser

Add a candidate user to the task

javascript
informat.bpmn.addTaskCandidateUser(moduleId, taskId, userId);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringProcess task ID
userIdStringCandidate user ID

Example

javascript
informat.bpmn.addTaskCandidateUser("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "zhangsan");

deleteTaskCandidateUser

Delete task candidate user

javascript
informat.bpmn.deleteTaskCandidateUser(moduleId, taskId, userId);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringProcess task ID
userIdStringCandidate user ID

Example

javascript
informat.bpmn.deleteTaskCandidateUser("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "zhangsan");

completeTask

Complete task

javascript
informat.bpmn.completeTask(moduleId, taskId, variables);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringProcess task ID
variablesObjectOutput data and process variables to be passed to subsequent steps when completing the task

Example

javascript
informat.bpmn.completeTask("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", null);

moveToActivity

Move the process node from its current position to another node

javascript
informat.bpmn.moveToActivity(moduleId, taskId, targetActivityId);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
taskIdStringProcess task ID
targetActivityIdStringTarget node ID (can be found in workflow "Set Flow Chart >> Select Node >> Basic Information")

Example

javascript
informat.bpmn.moveToActivity("flow", "a8c27e21-24af-11ef-bcd1-a6c0b0be7615", "Activity_0y15knc");

revokeInstance

Revoke process instance

javascript
informat.bpmn.revokeInstance(moduleId, instanceId, reason);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
instanceIdStringProcess instance ID
reasonStringRevocation reason

Example

javascript
informat.bpmn.revokeInstance("flow", "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a", "Cancel Process");

deleteInstance

Delete process instance

javascript
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.

ParameterTypeDescription
moduleIdStringWorkflow module identifier
instanceIdStringProcess instance ID
reasonStringDeletion reason

Example

javascript
informat.bpmn.deleteInstance("flow", "9cc1e6fa-ca24-11ed-8bc0-be634eacf49a", "Delete Process");

sendMessage

Send a message to a process instance or execution instance

javascript
informat.bpmn.sendMessage(moduleId, instanceId, messageName);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
instanceIdStringProcess instance ID
messageNameStringMessage name

Example

javascript
informat.bpmn.sendMessage("flow", "9cd49233-24b2-11ef-bcd1-a6c0b0be7615", "msg1");

sendSignal

Send a signal to a process instance or execution instance

javascript
informat.bpmn.sendSignal(moduleId, instanceId, signalName);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
instanceIdStringProcess instance ID
signalNameStringSignal name

Example

javascript
informat.bpmn.sendSignal("flow", "9cd49233-24b2-11ef-bcd1-a6c0b0be7615", "signal1");

trigger

Trigger a waiting process instance

javascript
informat.bpmn.trigger(moduleId, instanceId, activityId);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
instanceIdStringProcess instance ID
activityIdStringIntermediate event ID (can be viewed in the basic information of process design node)

Example

javascript
informat.bpmn.trigger("flow", "9cd49233-24b2-11ef-bcd1-a6c0b0be7615", "Activity_0jl4nsq");

getProcessDefineXml

Get the XML content of workflow definition

javascript
informat.bpmn.getProcessDefineXml(moduleId, procDefId);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
procDefIdStringProcess definition ID

Example

javascript
informat.bpmn.getProcessDefineXml("flow", "process_idy5gsmor6ym:100:ae4923cb-6d64-11ee-a8da-eed108c67451");
xml
<?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

javascript
informat.bpmn.generateProcessDiagram(moduleId, procDefId, config);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
procDefIdStringProcess definition ID
configBpmnProcessDiagramConfigConfiguration information

Example

javascript
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);
text
iVBORw0KGgoAAAANSUhEUgAAByYAAAImCAYAAAAWme0EAACAAElEQVR4XuzdCZxkVX33/8MmIuCCgiAiAwKi4...

setProcessInstanceName

Set workflow instance name

javascript
informat.bpmn.setProcessInstanceName(moduleId, instanceId, name);
ParameterTypeDescription
moduleIdStringWorkflow module ID
instanceIdStringWorkflow instance ID
nameStringInstance name

Example

javascript
informat.bpmn.setProcessInstanceName("flow", "a8bbc752-24af-11ef-bcd1-a6c0b0be7615", "new process instance name");

addMultiInstanceExecution

Add process execution for multi-instance

javascript
informat.bpmn.addMultiInstanceExecution(moduleId, activityId, parentExecutionId, variables);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
activityIdStringProcess node ID
parentExecutionIdStringParent process execution ID, can be process instance ID
variablesObjectProcess execution variables

Return Value

Returns the newly added process execution ID, type is String

Example

javascript
// 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);
text
c263580f-9402-11ee-b865-eed108c67451

Notes

This interface is only valid for multi-instance nodes

deleteMultiInstanceExecution

Delete process execution for multi-instance

javascript
informat.bpmn.deleteMultiInstanceExecution(moduleId, executionId, executionIsCompleted);
ParameterTypeDescription
moduleIdStringWorkflow module identifier
executionIdStringProcess node ID
executionIsCompletedBooleanWhether to mark process execution as completed

Example

javascript
// 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

javascript
informat.bpmn.addBpmnTaskCcList(taskId, copyUserList);
ParameterTypeDescription
taskIdStringID of the BPMN task.
copyUserListArray<String>List of user IDs to add as CC recipients.

Example

javascript
informat.bpmn.addBpmnTaskCcList("a8c27e21-24af-11ef-bcd1-a6c0b0be7615", ["yvkc2kwpy3xzr"]);

deleteBpmnTaskCc

This method removes a CC recipient from the BPMN task CC table.

javascript
informat.bpmn.deleteBpmnTaskCc(taskId, copyUserId);
ParameterTypeDescription
taskIdStringID of the BPMN task.
copyUserIdStringUser ID to remove from the CC list.

Example

javascript
informat.bpmn.deleteBpmnTaskCc("3cc8fe05-8b9f-11ee-bbf4-a6c0b0be7615", "zhangsan");

queryBpmnTaskCcList

Retrieves a list of BPMN task CC recipients based on the given query.

javascript
informat.bpmn.queryBpmnTaskCcList(query);
ParameterTypeDescription
queryQueryQuery object for filtering the BPMN task CC table.

Filterable Fields

ParameterTypeDescription
taskIdStringTask ID
copyUserIdStringCC User

Example

javascript
informat.bpmn.queryBpmnTaskCcList({
  pageIndex: 1,
  pageSize: 10,
  filter: {
    conditionList: [{ fieldId: "taskId", opt: "eq", value: "taskId" }],
  },
});
json
[
  {
    "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.

javascript
informat.bpmn.queryBpmnTaskCcListCount(filter);
ParameterTypeDescription
filterFilterFilter object for counting the BPMN task CC recipient table.

Example

javascript
informat.bpmn.queryBpmnTaskCcListCount({
  conditionList: [{ fieldId: "taskId", opt: "eq", value: "taskId" }],
});
text
2

getHistoryTaskVariables

Get process history task variables

javascript
informat.bpmn.getHistoryTaskVariables(taskId);
ParameterTypeDescription
taskIdStringProcess task ID

Return Value

Type Object, returns all variable values

Example

javascript
informat.bpmn.getHistoryTaskVariables("9cf63d7a-ca24-11ed-8bc0-be634eacf49a");

getHistoryTaskVariable

Get process history task variable

javascript
informat.bpmn.getHistoryTaskVariable(taskId, variableName);
ParameterTypeDescription
taskIdStringProcess task ID
variableNameStringVariable name

Return Value

Type Object, returns the variable value

Example

javascript
informat.bpmn.getHistoryTaskVariable("9cf63d7a-ca24-11ed-8bc0-be634eacf49a", "form");

deleteTasks

Delete workflow task list

javascript
informat.bpmn.deleteTasks(moduleId, taskIds, deleteReason, cascade);
ParameterTypeDescription
moduleIdStringModule identifier
taskIdsArray<String>Task ID list
deleteReasonStringDelete reason
cascadeBooleanWhether to cascade delete

Example

javascript
informat.bpmn.deleteTasks("flow", ["9cf63d7a-ca24-11ed-8bc0-be634eacf49a"], "testDel", true);

getStartSetting

Get process definition start settings

javascript
informat.bpmn.getStartSetting(moduleKey, defineId);
ParameterTypeDescription
moduleKeyStringModule identifier
defineIdStringProcess definition ID

Return Value

Return value type is BpmnStartSetting, the process start setting information

Example

javascript
informat.bpmn.getStartSetting("flow", "h141dq1w5ijpf");
json
{
  "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

javascript
informat.bpmn.getTaskSetting(procDefineId, taskDefKey);
ParameterTypeDescription
procDefineIdStringProcess definition ID
taskDefKeyStringTask definition ID

Return Value

Type BpmnTaskSetting

Example

javascript
informat.bpmn.getTaskSetting("process_swf2089hng2j:1:c0cc319f-7a59-11ef-bb07-0242d99c1a6f", "Activity_1nky9zn");
json
{
  "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"
}