### Start Process Instance with Transient Variables Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch04-API.md Example of passing transient variables when starting a process instance using the runtime service builder. ```java ProcessInstance processInstance = runtimeService.createProcessInstanceBuilder() .processDefinitionKey("someKey") .transientVariable("configParam01", "A") .transientVariable("configParam02", "B") .transientVariable("configParam03", "C") .start(); ``` -------------------------------- ### Paging Example with Tasks API Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/eventregistry/ch07-REST.md Shows how to use 'start' and 'size' parameters to paginate results from the runtime tasks API. The 'start' parameter acts as an offset. ```http GET /runtime/tasks?start=0&size=3 ``` ```http GET /runtime/tasks?start=3&size=3 ``` ```http GET /runtime/tasks?start=6&size=3 ``` -------------------------------- ### Start a process instance by key Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07a-BPMN-Introduction.md Uses the process ID defined in the XML to start the latest deployed version of the process. ```java ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProcess"); ``` -------------------------------- ### XML Configuration Example Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch03-Configuration.md Example of a Spring-based XML configuration file for the Flowable engine. ```xml ``` -------------------------------- ### Start a Case Instance Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/cmmn/ch08-REST.md Initiates a new case instance. You can start a case by its definition ID or key. Optional parameters include business key, tenant ID, and variables. ```APIDOC ## POST cmmn-runtime/case-instances ### Description Starts a new case instance based on a case definition ID or key. Supports optional business key, tenant ID, and variables. ### Method POST ### Endpoint /cmmn-runtime/case-instances ### Parameters #### Request Body - **caseDefinitionId** (string) - Required - The ID of the case definition to start. - **caseDefinitionKey** (string) - Required - The key of the case definition to start. Only one of `caseDefinitionId` or `caseDefinitionKey` can be used. - **businessKey** (string) - Optional - A business key for the case instance. - **tenantId** (string) - Optional - The tenant ID for the case instance. Defaults to the default tenant if omitted. - **variables** (array) - Optional - An array of variables to set for the case instance. Each object should have `name` and `value` properties. - **transientVariables** (array) - Optional - Similar to `variables`, but for transient variables. - **returnVariables** (boolean) - Optional - If true, returns the existing variables in the case instance context. ### Request Example ```json { "caseDefinitionId": "59fd213c-3c6b-11ea-8548-38c986587585", "variables": [ { "name": "myVar", "value": "This is a variable" } ] } ``` ```json { "caseDefinitionKey": "testCase", "businessKey": "myBusinessKey", "tenantId": "tenant1", "variables": [ { "name": "myVar", "value": "This is a variable" } ] } ``` ### Response #### Success Response (201) - **id** (string) - The ID of the created case instance. - **url** (string) - The URL of the created case instance. - **businessKey** (string) - The business key of the case instance. - **startTime** (string) - The timestamp when the case instance started. - **startUserId** (string) - The ID of the user who started the case instance. - **state** (string) - The current state of the case instance. - **ended** (boolean) - Indicates if the case instance has ended. - **caseDefinitionId** (string) - The ID of the case definition. - **caseDefinitionUrl** (string) - The URL of the case definition. - **caseDefinitionName** (string) - The name of the case definition. - **caseDefinitionDescription** (string) - The description of the case definition. - **parentId** (string) - The ID of the parent case instance, if any. - **callbackId** (string) - The callback ID. - **callbackType** (string) - The callback type. - **referenceId** (string) - The reference ID. - **referenceType** (string) - The reference type. - **variables** (array) - An array of variables associated with the case instance. - **tenantId** (string) - The tenant ID of the case instance. - **completed** (boolean) - Indicates if the case instance is completed. #### Response Example ```json { "id": "095fd94e-3c78-11ea-8548-38c986587585", "name": null, "url": "http://localhost:8080/flowable-rest/cmmn-api/cmmn-runtime/case-instances/095fd94e-3c78-11ea-8548-38c986587585", "businessKey": null, "startTime": "2020-01-21T19:01:23.923+01:00", "startUserId": "rest-admin", "state": "active", "ended": false, "caseDefinitionId": "59fd213c-3c6b-11ea-8548-38c986587585", "caseDefinitionUrl": "http://localhost:8080/flowable-rest/cmmn-api/cmmn-repository/case-definitions/59fd213c-3c6b-11ea-8548-38c986587585", "caseDefinitionName": "Test Case", "caseDefinitionDescription": null, "parentId": null, "callbackId": null, "callbackType": null, "referenceId": null, "referenceType": null, "variables": [ { "name": "myVar", "type": "string", "value": "This is a variable", "scope": "local" }, { "name": "initiator", "type": "string", "value": "rest-admin", "scope": "local" } ], "tenantId": "", "completed": false } ``` #### Error Response (400) - Indicates either the case-definition was not found (based on id or key) or an invalid variable has been passed. Status description contains additional information about the error. ``` -------------------------------- ### Start Process Instance via API Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md Use this when the process instance is started through the API by calling one of the startProcessInstanceByXXX methods. A sub-process always has a none start event. ```java ProcessInstance processInstance = runtimeService.startProcessInstanceByXXX(); ``` -------------------------------- ### XML Configuration Example Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/eventregistry/ch02-Configuration.md Example of a Spring-based XML configuration file for the Event Registry engine. ```xml ``` -------------------------------- ### Start Process Instance Request Bodies Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch14-REST.md Various JSON request formats for starting a process instance by definition ID, key, or message. ```json { "processDefinitionId":"oneTaskProcess:1:158", "businessKey":"myBusinessKey", "returnVariables":true, "variables": [ { "name":"myVar", "value":"This is a variable" } ] } ``` ```json { "processDefinitionKey":"oneTaskProcess", "businessKey":"myBusinessKey", "returnVariables":false, "tenantId": "tenant1", "variables": [ { "name":"myVar", "value":"This is a variable" } ] } ``` ```json { "message":"newOrderMessage", "businessKey":"myBusinessKey", "tenantId": "tenant1", "variables": [ { "name":"myVar", "value":"This is a variable" } ] } ``` -------------------------------- ### Signal Start Event API Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md Information on starting process instances using signal start events. ```APIDOC ## Signal Start Event API ### Description A signal start event can be used to start a process instance using a named signal. Signals can be 'fired' from within a process instance using a signal throw event or through the API (`runtimeService.signalEventReceivedXXX` methods). When a signal is fired, all process definitions with a matching signal start event will be initiated. ### Considerations - Process instances can be started synchronously or asynchronously. - The `signalName` passed to the API is the name attribute of the `signal` element referenced by the `signalRef` attribute of the `signalEventDefinition`. ``` -------------------------------- ### Run Maven Build Source: https://github.com/flowable/flowable-engine/blob/main/docs/public-api/tools/flowable-swagger-ui/README.md Executes a clean install of the project. ```bash mvn clean install ``` -------------------------------- ### Declaratively Start Process Instance with @StartProcess Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch15-Cdi.md Use the @StartProcess annotation to declaratively start a process instance by its key. The process instance is started after the annotated method returns. This can be combined with the method's transaction. ```java @StartProcess("authorizeBusinessTripRequest") public String submitRequest(BusinessTripRequest request) { // do some work return "success"; } ``` -------------------------------- ### Starting a Case Instance by Key Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/cmmn/ch05-Deployment.md This Java code demonstrates how to start a case instance using the case definition key. Flowable will automatically select the latest version of the case definition associated with the provided key. ```java runtimeService.createCaseInstanceBuilder().caseDefinitionKey("myCase").start() ``` -------------------------------- ### Starting Process Instance with Inclusive Gateway Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md Starts a Flowable process instance and asserts the number and name of tasks created based on process variables. This demonstrates how conditions on outgoing flows from an inclusive gateway are evaluated. ```java HashMap variableMap = new HashMap(); variableMap.put("receivedPayment", true); variableMap.put("shipOrder", true); ProcessInstance pi = runtimeService.startProcessInstanceByKey("forkJoin"); TaskQuery query = taskService.createTaskQuery() .processInstanceId(pi.getId()) .orderByTaskName() .asc(); List tasks = query.list(); assertEquals(1, tasks.size()); Task task = tasks.get(0); assertEquals("Ship Order", task.getName()); ``` -------------------------------- ### Start Process Instance by Message Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md Use these methods on the runtime service to start a new process instance when a message is received. Ensure the message name is correctly specified. ```java ProcessInstance startProcessInstanceByMessage(String messageName); ``` ```java ProcessInstance startProcessInstanceByMessage(String messageName, Map processVariables); ``` ```java ProcessInstance startProcessInstanceByMessage(String messageName, String businessKey, Map processVariables); ``` -------------------------------- ### Simple Camel Call Example Configuration Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md Provides the Spring context and Java route builder for a basic Camel integration example. ```xml org.flowable.camel.examples.simpleCamelCall ``` ```java public class SimpleCamelCallRoute extends RouteBuilder { @Override public void configure() throws Exception { from("flowable:SimpleCamelCallProcess:simpleCall").to("log:org.flowable.camel.examples.SimpleCamelCall"); } } ``` -------------------------------- ### None Start Event with Form Key Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md References a form definition that users have to fill in when starting a new process instance. More information can be found in the forms section. ```xml ``` -------------------------------- ### Start H2 Web Server for Debugging Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch04-API.md Use this command in the 'Display' window of your IDE to start an H2 web server, allowing you to inspect the in-memory database during unit test debugging. Ensure the H2 database is accessible. ```java org.h2.tools.Server.createWebServer("-web").start() ``` -------------------------------- ### Plan Item Instance Response Body Example Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/cmmn/ch08-REST.md This is an example of the JSON response body when successfully retrieving plan item instances. It includes details about the plan item instances, total count, and pagination information. ```json { "data": [ { "id": "09618702-3c78-11ea-8548-38c986587585", "url": "http://localhost:8080/flowable-rest/cmmn-api/cmmn-runtime/plan-item-instances/09618702-3c78-11ea-8548-38c986587585", "name": null, "caseInstanceId": "095fd94e-3c78-11ea-8548-38c986587585", "caseInstanceUrl": "http://localhost:8080/flowable-rest/cmmn-api/cmmn-runtime/case-instances/095fd94e-3c78-11ea-8548-38c986587585", "caseDefinitionId": "59fd213c-3c6b-11ea-8548-38c986587585", "caseDefinitionUrl": "http://localhost:8080/flowable-rest/cmmn-api/cmmn-repository/case-definitions/59fd213c-3c6b-11ea-8548-38c986587585", "derivedCaseDefinitionId": null, "derivedCaseDefinitionUrl": null, "stageInstanceId": null, "stageInstanceUrl": null, "planItemDefinitionId": "expandedStage1", "planItemDefinitionType": "stage", "state": "active", "stage": true, "elementId": "planItem2", "createTime": "2020-01-21T19:01:23.934+01:00", "lastAvailableTime": "2020-01-21T19:01:23.942+01:00", "lastEnabledTime": null, "lastDisabledTime": null, "lastStartedTime": "2020-01-21T19:01:23.974+01:00", "lastSuspendedTime": null, "completedTime": null, "occurredTime": null, "terminatedTime": null, "exitTime": null, "endedTime": null, "startUserId": null, "referenceId": null, "referenceType": null, "completable": false, "entryCriterionId": null, "exitCriterionId": null, "formKey": null, "extraValue": null, "tenantId": "" }, ... ], "total": 3, "start": 0, "sort": "createTime", "order": "asc", "size": 3 } ``` -------------------------------- ### Message Start Event XML Representation Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md Example of the XML structure for a message start event. ```APIDOC ## Message Start Event XML Representation ### Description The XML representation of a message start event includes a `messageEventDefinition` child element within the `startEvent` declaration. ### XML Example ```xml ... ``` ``` -------------------------------- ### Initialize ProcessEngine and execute process Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07a-BPMN-Introduction.md A complete example demonstrating the creation of a standalone ProcessEngine, service retrieval, deployment, and process initiation. ```java public static void main(String[] args) { // Create Flowable process engine ProcessEngine processEngine = ProcessEngineConfiguration .createStandaloneProcessEngineConfiguration() .buildProcessEngine(); // Get Flowable services RepositoryService repositoryService = processEngine.getRepositoryService(); RuntimeService runtimeService = processEngine.getRuntimeService(); // Deploy the process definition repositoryService.createDeployment() .addClasspathResource("FinancialReportProcess.bpmn20.xml") .deploy(); // Start a process instance runtimeService.startProcessInstanceByKey("financialReport"); } ``` -------------------------------- ### Define Auto-deployment Processes in processes.xml Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch15-Cdi.md Example processes.xml file used for auto-deploying processes located on the classpath. ```xml ``` -------------------------------- ### Flowable Engine Tutorial Example Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07a-BPMN-Introduction.md This Java code demonstrates a complete workflow for the Flowable engine. It includes process engine creation, deployment, instance startup, task querying, claiming, completion, and historical verification. Ensure the 'FinancialReportProcess.bpmn20.xml' is in the classpath. ```java public class TenMinuteTutorial { public static void main(String[] args) { // Create Flowable process engine ProcessEngine processEngine = ProcessEngineConfiguration .createStandaloneProcessEngineConfiguration() .buildProcessEngine(); // Get Flowable services RepositoryService repositoryService = processEngine.getRepositoryService(); RuntimeService runtimeService = processEngine.getRuntimeService(); // Deploy the process definition repositoryService.createDeployment() .addClasspathResource("FinancialReportProcess.bpmn20.xml") .deploy(); // Start a process instance String procId = runtimeService.startProcessInstanceByKey("financialReport").getId(); // Get the first task TaskService taskService = processEngine.getTaskService(); List tasks = taskService.createTaskQuery().taskCandidateGroup("accountancy").list(); for (Task task : tasks) { System.out.println("Following task is available for accountancy group: " + task.getName()); // claim it taskService.claim(task.getId(), "fozzie"); } // Verify Fozzie can now retrieve the task tasks = taskService.createTaskQuery().taskAssignee("fozzie").list(); for (Task task : tasks) { System.out.println("Task for fozzie: " + task.getName()); // Complete the task taskService.complete(task.getId()); } System.out.println("Number of tasks for fozzie: " + taskService.createTaskQuery().taskAssignee("fozzie").count()); // Retrieve and claim the second task tasks = taskService.createTaskQuery().taskCandidateGroup("management").list(); for (Task task : tasks) { System.out.println("Following task is available for management group: " + task.getName()); taskService.claim(task.getId(), "kermit"); } // Completing the second task ends the process for (Task task : tasks) { taskService.complete(task.getId()); } // verify that the process is actually finished HistoryService historyService = processEngine.getHistoryService(); HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(procId).singleResult(); System.out.println("Process instance end time: " + historicProcessInstance.getEndTime()); } } ``` -------------------------------- ### Start Case Instance Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/cmmn/ch06-cmmn.md Initiate a new case instance using the case definition key and provide initial process variables. ```java CmmnRuntimeService cmmnRuntimeService = cmmnEngine.getCmmnRuntimeService(); CaseInstance caseInstance = cmmnRuntimeService.createCaseInstanceBuilder() .caseDefinitionKey("employeeOnboarding") .variable("potentialEmployee", "johnDoe") .start(); ``` -------------------------------- ### Configure HTTP GET Task Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md Example of a basic HTTP GET request configuration using extension elements for headers, timeout, and result variable prefixing. ```xml task7 ``` -------------------------------- ### Get Involved People - Success Response Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch14-REST.md Example response body for getting involved people for a process instance. It lists users and their associated types of involvement. ```json [ { "url":"http://localhost:8182/runtime/process-instances/5/identitylinks/users/john/customType", "user":"john", "group":null, "type":"customType" }, { "url":"http://localhost:8182/runtime/process-instances/5/identitylinks/users/paul/candidate", "user":"paul", "group":null, "type":"candidate" } ] ``` -------------------------------- ### Build ProcessEngine Programmatically Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch03-Configuration.md Example of creating and configuring a ProcessEngine instance in code. ```java ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration() .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE) .setJdbcUrl("jdbc:h2:mem:my-own-db;DB_CLOSE_DELAY=1000") .setAsyncExecutorActivate(false) .buildProcessEngine(); ``` -------------------------------- ### Start a process instance by key Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch06-Deployment.md Method call to initiate a process instance, which defaults to the latest version of the process definition. ```java runtimeService.startProcessInstanceByKey("myProcess") ``` -------------------------------- ### Start Flowable REST with PostgreSQL Source: https://github.com/flowable/flowable-engine/blob/main/docker/README.md Use this command to start, stop, or get information about the Flowable REST service with a PostgreSQL database. Access the service at http://localhost:8080/flowable-rest/. ```bash ./rest-postgres.sh start|stop|info ``` -------------------------------- ### Define Message Events in BPMN Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md Example of declaring message elements and referencing them within start and intermediate catching events. ```xml ... ... ``` -------------------------------- ### Parent Completion Rule Example Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/cmmn/ch06-cmmn.md This example demonstrates the 'ignoreAfterFirstCompletionIfAvailableOrEnabled' parent completion rule for a plan item, combined with repetition, required rule, and manual activation. It ensures the parent is not completed if the plan item hasn't been started and completed at least once, and is not active afterwards. ```xml ``` -------------------------------- ### Start a process instance by key Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07a-BPMN-Introduction.md Initiates a new process instance using the process definition key defined in the BPMN XML. ```java ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("financialReport"); ``` -------------------------------- ### Build Engine with Custom Configuration Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/eventregistry/ch02-Configuration.md Example of creating an in-memory engine and customizing properties before building. ```java EventRegistryEngine eventRegistryEngine = EventRegistryEngineConfiguration.createStandaloneInMemEventRegistryEngineConfiguration() .setDatabaseSchemaUpdate(EventRegistryEngineConfiguration.DB_SCHEMA_UPDATE_FALSE) .setJdbcUrl("jdbc:h2:mem:my-own-db;DB_CLOSE_DELAY=1000") .buildEventRegistryEngine(); ``` -------------------------------- ### Example response body for getting all identity links Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch14-REST.md This JSON structure represents the response when retrieving all identity links for a task, showing both user and group associations. ```json [ { "userId" : "kermit", "groupId" : null, "type" : "candidate", "url" : "http://localhost:8081/flowable-rest/service/runtime/tasks/100/identitylinks/users/kermit/candidate" }, { "userId" : null, "groupId" : "sales", "type" : "candidate", "url" : "http://localhost:8081/flowable-rest/service/runtime/tasks/100/identitylinks/groups/sales/candidate" }, ... ] ``` -------------------------------- ### Event Sub-Process XML Example Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md This XML snippet defines an Event Sub-Process triggered by an Error Start Event. It is scoped to the process instance and handles errors at the process level. ```xml ``` -------------------------------- ### Start Process Instance with Variables Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch04-API.md Initialize a process instance with a map of variables using the RuntimeService. ```java ProcessInstance startProcessInstanceByKey(String processDefinitionKey, Map variables); ``` -------------------------------- ### Define potential starters using process attributes Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md Use flowable:candidateStarterUsers and flowable:candidateStarterGroups attributes on the process tag for a more concise configuration. ```xml ... ``` -------------------------------- ### Get Form Data Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch14-REST.md Retrieves form data associated with a task or a process definition's start event. Requires either a taskId or a processDefinitionId. The response includes form properties that can be displayed to the user. ```json { "data": [ { "formKey" : null, "deploymentId" : "2", "processDefinitionId" : "3", "processDefinitionUrl" : "http://localhost:8182/repository/process-definition/3", "taskId" : "6", "taskUrl" : "http://localhost:8182/runtime/task/6", "formProperties" : [ { "id" : "room", "name" : "Room", "type" : "string", "value" : null, "readable" : true, "writable" : true, "required" : true, "datePattern" : null, "enumValues" : [ { "id" : "normal", "name" : "Normal bed" }, { "id" : "kingsize", "name" : "Kingsize bed" }, ] } ] } ], "total": 1, "start": 0, "sort": "name", "order": "asc", "size": 1 } ``` -------------------------------- ### Timer Start Event - Single Date Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md Configures a timer start event for a process that should start only once on a selected date. The process will start once, on the specified date and time. ```xml 2011-03-11T12:13:14 ``` -------------------------------- ### Timer Start Event - Multiple Intervals Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md Configures a timer start event for a process that should start multiple times in specific intervals. The process will start 4 times, in 5 minute intervals, starting on 11th March 2011, 12:13. ```xml R4/2011-03-11T12:13/PT5M ``` -------------------------------- ### None Start Event XML Representation Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md The XML representation of a none start event is the normal start event declaration without any sub-element. This is used when the trigger for starting the process instance is unspecified. ```xml ``` -------------------------------- ### Message Start Event API Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md API methods for starting process instances using message start events. ```APIDOC ## Message Start Event API ### Description A message start event can be used to start a process instance using a named message. This allows for selecting the correct start event from a set of alternative start events using the message name. ### Methods - `ProcessInstance startProcessInstanceByMessage(String messageName)` - `ProcessInstance startProcessInstanceByMessage(String messageName, Map processVariables)` - `ProcessInstance startProcessInstanceByMessage(String messageName, String businessKey, Map processVariables)` ### Considerations - Message start events are only supported on top-level processes, not on embedded sub-processes. - If a process definition has multiple message start events, `runtimeService.startProcessInstanceByMessage(...)` allows selection. - If a process definition has multiple message start events and a single none start event, `runtimeService.startInstanceByKey(...)` and `runtimeService.startInstanceById(...)` will use the none start event. - If a process definition has multiple message start events and no none start event, `runtimeService.startInstanceByKey(...)` and `runtimeService.startInstanceById(...)` will throw an exception. - If a process definition has a single message start event, `runtimeService.startInstanceByKey(...)` and `runtimeService.startInstanceById(...)` will start a new process instance using the message start event. - When starting a process from a call activity, message start events are supported if the process has a single none start event in addition to the message start event(s), or if the process has a single message start event and no other start events. ``` -------------------------------- ### Deploying a Process Definition with Flowable Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch02-GettingStarted.md Use RepositoryService to create a deployment by adding BPMN 2.0 XML resources from the classpath and then calling deploy(). ```java RepositoryService repositoryService = processEngine.getRepositoryService(); Deployment deployment = repositoryService.createDeployment() .addClasspathResource("holiday-request.bpmn20.xml") .deploy(); ``` -------------------------------- ### POST runtime/process-instances Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch14-REST.md Starts a new process instance using a process definition ID, key, or message. ```APIDOC ## POST runtime/process-instances ### Description Starts a new process instance. Only one of processDefinitionId, processDefinitionKey, or message can be used. ### Method POST ### Endpoint runtime/process-instances ### Parameters #### Request Body - **processDefinitionId** (String) - Optional - The ID of the process definition. - **processDefinitionKey** (String) - Optional - The key of the process definition. - **message** (String) - Optional - The message to start the process. - **businessKey** (String) - Optional - The business key for the process instance. - **returnVariables** (Boolean) - Optional - Whether to return existing variables in the response. - **tenantId** (String) - Optional - The tenant ID. - **variables** (Array) - Optional - List of variables to set. - **transientVariables** (Array) - Optional - List of transient variables to set. ### Request Example { "processDefinitionKey":"oneTaskProcess", "businessKey":"myBusinessKey", "returnVariables":false, "tenantId": "tenant1", "variables": [ { "name":"myVar", "value":"This is a variable" } ] } ### Response #### Success Response (201) - **id** (String) - The ID of the created process instance. - **url** (String) - The URL of the created process instance. - **businessKey** (String) - The business key. - **suspended** (Boolean) - Whether the instance is suspended. - **processDefinitionUrl** (String) - URL to the process definition. - **activityId** (String) - The current activity ID. - **tenantId** (String) - The tenant ID. #### Error Responses - 400: Indicates the process-definition was not found, no process is started by the message, or an invalid variable was passed. ``` -------------------------------- ### Start a process instance via REST Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch02-GettingStarted.md Initiates a process instance by providing the process definition key and initial variables. ```bash curl --user rest-admin:test -H "Content-Type: application/json" -X POST -d '{ "processDefinitionKey":"holidayRequest", "variables": [ { "name":"employee", "value": "John Doe" }, { "name":"nrOfHolidays", "value": 7 }]}' http://localhost:8080/flowable-rest/service/runtime/process-instances ``` -------------------------------- ### Example URL with Query Parameter Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/eventregistry/ch07-REST.md Demonstrates how to use a 'name' parameter in a URL query string for the event registry repository deployments API. ```http http://host/flowable-rest/event-registry-api/event-registry-repository/deployments?name=Deployment ``` -------------------------------- ### Error Start Event XML Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md Configures an error start event for an Event Sub-Process using an errorEventDefinition. ```xml ``` -------------------------------- ### Flowable Initiator Property in Start Event Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md Configure a start event to store the authenticated user ID in a process variable using the 'initiator' attribute. Ensure the user ID is set and cleared correctly around process instance starts. ```xml ``` -------------------------------- ### Start a case instance Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/cmmn/ch08-REST.md Use these JSON request bodies to initiate a case instance by either ID or key. Only one of caseDefinitionId or caseDefinitionKey can be provided. ```json { "caseDefinitionId":"59fd213c-3c6b-11ea-8548-38c986587585", "variables": [ { "name":"myVar", "value":"This is a variable" } ] } ``` ```json { "caseDefinitionKey":"testCase", "businessKey":"myBusinessKey", "tenantId": "tenant1", "variables": [ { "name":"myVar", "value":"This is a variable" } ] } ``` -------------------------------- ### Install Widdershins Source: https://github.com/flowable/flowable-engine/blob/main/docs/public-api/tools/flowable-slate/README.md Install the widdershins library globally or locally. This tool translates swagger definitions into slate-compatible markdown. ```bash npm install [-g] widdershins ``` -------------------------------- ### Start Process Instance Success Response Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch14-REST.md The JSON response returned upon successfully creating a new process instance. ```json { "id":"7", "url":"http://localhost:8182/runtime/process-instances/7", "businessKey":"myBusinessKey", "suspended":false, "processDefinitionUrl":"http://localhost:8182/repository/process-definitions/processOne%3A1%3A4", "activityId":"processTask", "tenantId" : null } ``` -------------------------------- ### Signal Start Event XML Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md Defines a signal start event using a signalEventDefinition child element within a startEvent. ```xml ``` -------------------------------- ### Define Message Start Event in XML Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07b-BPMN-Constructs.md XML structure for declaring a message start event within a process definition. ```xml ... ``` -------------------------------- ### Start a process instance via RuntimeService Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch02-GettingStarted.md Initiates a process instance using a key and a map of variables. The key must match the id attribute defined in the BPMN 2.0 XML. ```xml ``` ```java RuntimeService runtimeService = processEngine.getRuntimeService(); Map variables = new HashMap(); variables.put("employee", employee); variables.put("nrOfHolidays", nrOfHolidays); variables.put("description", description); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("holidayRequest", variables); ``` -------------------------------- ### Deploy a process definition Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch07a-BPMN-Introduction.md Uses the repositoryService to deploy a BPMN 2.0 XML file from the classpath to the persistent datastore. ```java Deployment deployment = repositoryService.createDeployment() .addClasspathResource("FinancialReportProcess.bpmn20.xml") .deploy(); ``` -------------------------------- ### Create Standalone DmnEngineConfiguration Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/dmn/ch02-Configuration.md Initializes configuration without an external XML file using default settings. ```java DmnEngineConfiguration.createStandaloneDmnEngineConfiguration(); DmnEngineConfiguration.createStandaloneInMemDmnEngineConfiguration(); ``` -------------------------------- ### Example URL with Sorting Parameter Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/eventregistry/ch07-REST.md Illustrates adding a 'sort' parameter to a URL query string for the event registry repository deployments API. ```http http://host/flowable-rest/event-registry-api/event-registry-repository/deployments?sort=name ``` -------------------------------- ### DMN 1.1 Definitions Element Example Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/dmn/ch06-DMN-Introduction.md An example of the root 'definitions' element in a DMN 1.1 schema, containing a decision definition with a decision table. ```xml .. ``` -------------------------------- ### Example Flowable CMMN XML Configuration Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/cmmn/ch02-Configuration.md An example of a Spring XML configuration for the CmmnEngineConfiguration, specifying JDBC connection details and schema update behavior. ```xml ``` -------------------------------- ### Configure Process Engine with LoggingListener Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/bpmn/ch17-Advanced.md Demonstrates how to configure a standalone in-memory ProcessEngine with a custom LoggingListener. Ensure the database schema update is set appropriately for your use case. ```java ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration() .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE) .setJdbcUrl("jdbc:h2:mem:my-own-db;DB_CLOSE_DELAY=1000") .setLoggingListener(new MyLoggingListener()) .buildProcessEngine(); ``` -------------------------------- ### Start Enabled Plan Item Instance Source: https://github.com/flowable/flowable-engine/blob/main/docs/docusaurus/docs/cmmn/ch06-cmmn.md Initiates the execution of a plan item instance that is currently in the 'enabled' state. This method should be called after querying for enabled instances. ```java cmmnRuntimeService.startPlanItemInstance(planItemInstance.getId()); ``` -------------------------------- ### Install GNU Sed on macOS Source: https://github.com/flowable/flowable-engine/blob/main/docs/public-api/tools/flowable-slate/README.md If GNU sed is not present on macOS, install it using Homebrew. This command ensures the GNU version is used with default names. ```bash brew install gnu-sed --with-default-names ```