Home / Docs / Guides / BPMN Kit Text — element reference

BPMN Kit Text — element reference

Every element of BPMN Kit Text with a rendered diagram, the line that writes it and the BPMN Kit Fluent code that builds the same thing. Tasks, gateways, events, boundaries, pools, lanes and ad-hoc agents.

How to read this page

Each element has a short note, a bpmnkit-text block and its BPMN Kit Fluent equivalent. The text block is rendered to a diagram when the site is built, so what you see is what parseProcessText reads. A test parses every block on this page and builds every Fluent snippet.

  • The line format is explained in BPMN Kit Text — the line format.
  • Fluent snippets assume import { Bpmn } from "@bpmnkit/core" and end in .build().
  • A node is id[kind Name | attributes]. Write the bracket the first time; afterwards write only id.
  • Text fills in what it can leave out: ids, join gateways, a missing end event. Fluent states every id.

Process basics and tasks

The first line is # Process name. A path is a > b > c. A start event, an end event and one task make the smallest process.

Smallest processBPMN process diagram. Steps: Begin, Do the work, Finish.Do the workBeginFinish
const defs = Bpmn.createProcess("smallest")
  .name("Smallest process")
  .startEvent("begin", { name: "Begin" })
  .task("work", { name: "Do the work" })
  .endEvent("finish", { name: "Finish" })
  .build()

user — a person does it

form= links a form. user also reads the aliases human.

User taskBPMN process diagram. Steps: Request, Review request, Reviewed.ReviewrequestRequestReviewed
const defs = Bpmn.createProcess("user-task")
  .name("User task")
  .startEvent("s", { name: "Request" })
  .userTask("review", { name: "Review request", formId: "review_form" })
  .endEvent("e", { name: "Reviewed" })
  .build()

service — a worker runs a job

job= is the job type the worker subscribes to. result= names the variable that holds the result.

Service taskBPMN process diagram. Steps: Order placed, Charge card, Paid.Charge cardOrder placedPaid
const defs = Bpmn.createProcess("service-task")
  .name("Service task")
  .startEvent("s", { name: "Order placed" })
  .serviceTask("pay", { name: "Charge card", taskType: "charge-card", ioMapping: { outputs: [{ source: "= result", target: "receipt" }] } })
  .endEvent("e", { name: "Paid" })
  .build()

rule — a DMN decision

rule is a business rule task. The aliases decision and dmn mean the same.

Rule taskBPMN process diagram. Steps: Loan asked, Score applicant, Scored.ScoreapplicantLoan askedScored
const defs = Bpmn.createProcess("rule-task")
  .name("Rule task")
  .startEvent("s", { name: "Loan asked" })
  .businessRuleTask("score", { name: "Score applicant", decisionId: "applicant-score", resultVariable: "score" })
  .endEvent("e", { name: "Scored" })
  .build()

script — FEEL on process data

Use a script task for work that only reads variables: count, sum, filter, format. feel= is last on the line and takes the rest of it.

Script taskBPMN process diagram. Steps: Counted, Count open, Done.Count openCountedDone
const defs = Bpmn.createProcess("script-task")
  .name("Script task")
  .startEvent("s", { name: "Counted" })
  .scriptTask("count", { name: "Count open", expression: '= count(issues[state = "open"])', resultVariable: "openCount" })
  .endEvent("e", { name: "Done" })
  .build()

send and receive — messages

A send task publishes a message. A receive task waits for one: it needs msg= and key=.

Send and receiveBPMN process diagram. Steps: Order shipped, Tell customer, Wait for reply, Replied.TellcustomerWait forreplyOrder shippedReplied
const defs = Bpmn.createProcess("send-receive")
  .name("Send and receive")
  .startEvent("s", { name: "Order shipped" })
  .sendTask("tell", { name: "Tell customer", taskType: "notify" })
  .receiveTask("wait", { name: "Wait for reply", messageName: "reply", correlationKey: "= orderId" })
  .endEvent("e", { name: "Replied" })
  .build()

manual and task

manual is work done outside the engine. task is the plain task with no type.

Manual and plainBPMN process diagram. Steps: Parcel arrived, Pack parcel, Log it, Done.Pack parcelLog itParcel arrivedDone
const defs = Bpmn.createProcess("manual-plain")
  .name("Manual and plain")
  .startEvent("s", { name: "Parcel arrived" })
  .manualTask("pack", { name: "Pack parcel" })
  .task("log", { name: "Log it" })
  .endEvent("e", { name: "Done" })
  .build()

call — another process

called= is the id of the process to call. in. and out. map variables in and out of the call.

Call activityBPMN process diagram. Steps: Order, Bill customer, Billed.BillcustomerOrderBilled
const defs = Bpmn.createProcess("call-activity")
  .name("Call activity")
  .startEvent("s", { name: "Order" })
  .callActivity("bill", {
    name: "Bill customer",
    processId: "billing",
    ioMapping: { inputs: [{ source: "= total", target: "amount" }], outputs: [{ source: "= invoiceId", target: "invoice" }] },
  })
  .endEvent("e", { name: "Billed" })
  .build()

each= — once per item

each=<list> runs the task once for every item of the list (a multi-instance task).

For each itemBPMN process diagram. Steps: Order, Pick item, Picked.Pick itemOrderPicked
const defs = Bpmn.createProcess("for-each")
  .name("For each item")
  .startEvent("s", { name: "Order" })
  .serviceTask("pick", { name: "Pick item", taskType: "pick", multiInstance: { collection: "= items", elementVariable: "item" } })
  .endEvent("e", { name: "Picked" })
  .build()

Gateways

A gateway has one line for the path into it and one line for each branch out of it. A branch is gw >(Label: FEEL condition) next. Exactly one branch of an xor is (Label: default).

xor — exactly one branch

xor reads the aliases exclusive and gateway.

Exclusive choiceBPMN process diagram. Steps: Expense, Over 1000?, Review, Paid, Approve.ReviewApproveExpenseOver 1000?Paid
const defs = Bpmn.createProcess("xor")
  .name("Exclusive choice")
  .startEvent("s", { name: "Expense" })
  .exclusiveGateway("check", { name: "Over 1000?" })
  .branch("Yes", (b) => b.condition("= amount > 1000").userTask("review", { name: "Review" }).endEvent("e", { name: "Paid" }))
  .branch("No", (b) => b.defaultFlow().serviceTask("auto", { name: "Approve", taskType: "approve" }).connectTo("e"))
  .build()

The two branches meet at e. Text joins them with an xor for you (a fix, not a problem). Fluent infers the same join, or you close the branch yourself with .connectTo("e").

and — all branches

and splits into parallel paths and waits for all of them where they meet. The alias is parallel.

Parallel workBPMN process diagram. Steps: Order, Fork, Pack, Join, Invoice, Done.PackInvoiceOrderForkJoinDone
const defs = Bpmn.createProcess("parallel")
  .name("Parallel work")
  .startEvent("s", { name: "Order" })
  .parallelGateway("fork", { name: "Fork" })
  .branch("pack", (b) => b.task("pack", { name: "Pack" }).parallelGateway("join", { name: "Join" }))
  .branch("bill", (b) => b.task("bill", { name: "Invoice" }).connectTo("join"))
  .endEvent("e", { name: "Done" })
  .build()

or — one or more branches

or takes every branch whose condition holds. It also has a default. The alias is inclusive.

Inclusive choiceBPMN process diagram. Steps: Order, What to send?, Wrap, Sent, Ship express, Ship standard.WrapShip expressShipstandardOrderWhat to send?Sent
const defs = Bpmn.createProcess("or")
  .name("Inclusive choice")
  .startEvent("s", { name: "Order" })
  .inclusiveGateway("pick", { name: "What to send?" })
  .branch("Gift", (b) => b.condition("= gift = true").task("wrap", { name: "Wrap" }).endEvent("e", { name: "Sent" }))
  .branch("Express", (b) => b.condition("= express = true").task("fast", { name: "Ship express" }).connectTo("e"))
  .branch("Default", (b) => b.defaultFlow().task("std", { name: "Ship standard" }).connectTo("e"))
  .build()

eventgw — the first event wins

An event-based gateway leads to catch events. The first one that happens takes the path.

RaceBPMN process diagram. Steps: Quote sent, Wait, Customer answers, Answered, Seven days, Expired.Quote sentWaitCustomer answersAnsweredSeven daysExpired
const defs = Bpmn.createProcess("race-process")
  .name("Race")
  .startEvent("s", { name: "Quote sent" })
  .eventBasedGateway("race", { name: "Wait" })
  .branch("answer", (b) => b.intermediateCatchEvent("answer", { name: "Customer answers", messageName: "answer", correlationKey: "= quoteId" }).endEvent("e", { name: "Answered" }))
  .branch("late", (b) => b.intermediateCatchEvent("late", { name: "Seven days", timerDuration: "P7D" }).endEvent("e2", { name: "Expired" }))
  .build()

Events and exceptions

An event is start, end, catch (waits), throw (sends) or boundary (sits on a task). Add a trigger after a colon: start:message, end:error, catch:timer. The triggers are timer, message, signal, error, escalation, terminate, conditional, compensate, link and cancel. event reads as a catch. link is the one trigger you cannot use: Text has no attribute for the link name, so the parser reports it and draws a plain event. Use .intermediateThrowEvent(id, { linkName }) in Fluent.

Start events

Start by messageBPMN process diagram. Steps: Order arrives, Handle, Handled.HandleOrder arrivesHandled
const defs = Bpmn.createProcess("start-message")
  .name("Start by message")
  .startEvent("s", { name: "Order arrives", messageName: "new-order", correlationKey: "= orderId" })
  .task("t", { name: "Handle" })
  .endEvent("e", { name: "Handled" })
  .build()

A timer start takes every= (a cycle) or at= (a date-time):

Start by timerBPMN process diagram. Steps: Every night, Run report, Reported.Run reportEvery nightReported
const defs = Bpmn.createProcess("start-timer")
  .name("Start by timer")
  .startEvent("s", { name: "Every night", timerCycle: "R/PT24H" })
  .task("t", { name: "Run report" })
  .endEvent("e", { name: "Reported" })
  .build()

End events

end:error, end:signal and end:escalation take the code or name after a bar. end:terminate stops the whole process at once.

End eventsBPMN process diagram. Steps: Payment, Paid?, Done, Payment failed.PaymentPaid?DonePayment failed
const defs = Bpmn.createProcess("end-events")
  .name("End events")
  .startEvent("s", { name: "Payment" })
  .exclusiveGateway("check", { name: "Paid?" })
  .branch("Yes", (b) => b.condition("= paid").endEvent("ok", { name: "Done" }))
  .branch("No", (b) => b.defaultFlow().endEvent("bad", { name: "Payment failed", errorCode: "PAY_FAILED" }))
  .build()

Intermediate catch and throw

catch:timer waits (after= is an ISO duration). throw:signal and throw:escalation raise something. throw:message is a message throw event; catch:message needs msg= and key=.

Wait, then signalBPMN process diagram. Steps: Started, Wait an hour, Tell others, Done.StartedWait an hourTell othersDone
const defs = Bpmn.createProcess("wait-signal")
  .name("Wait, then signal")
  .startEvent("s", { name: "Started" })
  .intermediateCatchEvent("wait", { name: "Wait an hour", timerDuration: "PT1H" })
  .intermediateThrowEvent("ping", { name: "Tell others", signalName: "wake-up" })
  .endEvent("e", { name: "Done" })
  .build()

Boundary events

A boundary starts its own line, names its task with on=, and leads only to the handling. By default it interrupts the task. nonint keeps the task running.

Timeout on a taskBPMN process diagram. Steps: Request, Do the work, Done, Too slow, Remind owner, Reminded.Do the workRemind ownerRequestDoneToo slowReminded
const defs = Bpmn.createProcess("boundary-timer")
  .name("Timeout on a task")
  .startEvent("s", { name: "Request" })
  .userTask("work", { name: "Do the work" })
  .withBoundary("late", { name: "Too slow", timerDuration: "PT2H" }, (b) =>
    b.sendTask("nudge", { name: "Remind owner", taskType: "remind" }).endEvent("e2", { name: "Reminded" }),
  )
  .endEvent("e", { name: "Done" })
  .build()

An error boundary catches the error an inner step raises, matched by error=:

Error on a taskBPMN process diagram. Steps: Order, Pay, Paid, Payment failed, Tell submitter, Failed.PayTellsubmitterOrderPaidPayment failedFailed
const defs = Bpmn.createProcess("boundary-error")
  .name("Error on a task")
  .startEvent("s", { name: "Order" })
  .serviceTask("pay", { name: "Pay", taskType: "pay" })
  .withBoundary("failed", { name: "Payment failed", errorCode: "PAY_FAILED" }, (b) =>
    b.sendTask("notify", { name: "Tell submitter", taskType: "notify" }).endEvent("e2", { name: "Failed" }),
  )
  .endEvent("e", { name: "Paid" })
  .build()

A non-interrupting boundary (nonint) fires beside the task:

Reminder beside a taskBPMN process diagram. Steps: Request, Do the work, Done, One hour, Remind, Reminded.Do the workRemindRequestDoneOne hourReminded
const defs = Bpmn.createProcess("boundary-nonint")
  .name("Reminder beside a task")
  .startEvent("s", { name: "Request" })
  .userTask("work", { name: "Do the work" })
  .withBoundary("nudge", { name: "One hour", timerDuration: "PT1H", cancelActivity: false }, (b) =>
    b.sendTask("ping", { name: "Remind", taskType: "remind" }).endEvent("e2", { name: "Reminded" }),
  )
  .endEvent("e", { name: "Done" })
  .build()

boundary:message, boundary:signal, boundary:escalation, boundary:conditional, boundary:compensate and boundary:cancel work the same way, with the matching msg=/key=, signal=, escalation= attribute where one is needed.

Pools, lanes and messages

A lane line names who does which nodes. Every node is in one lane. A pool is another party, drawn as an empty pool, and a msg line is a message to it or from it.

Order with lanesBPMN process diagram. Steps: Order placed, Check order, Ship, Shipped.Order with lanesSalesOperationsCheck orderShipOrder placedShipped
const defs = Bpmn.createProcess("lanes")
  .name("Order with lanes")
  .inLane("sales", { name: "Sales" })
  .startEvent("s", { name: "Order placed" })
  .userTask("check", { name: "Check order" })
  .inLane("ops", { name: "Operations" })
  .serviceTask("ship", { name: "Ship", taskType: "ship" })
  .endEvent("e", { name: "Shipped" })
  .build()
Order with a bankBPMN process diagram. Steps: Order, Ask bank to pay, Bank confirms, Paid.BankOrder with a bankAsk bank topayOrderBank confirmsPaid
const defs = Bpmn.createDiagram("order-bank")
  .process("order", (p) =>
    p
      .name("Order with a bank")
      .startEvent("s", { name: "Order" })
      .sendTask("pay", { name: "Ask bank to pay", taskType: "pay" })
      .intermediateCatchEvent("wait", { name: "Bank confirms", messageName: "paid", correlationKey: "= orderId" })
      .endEvent("e", { name: "Paid" }),
  )
  .process("bank", (p) => p.name("Bank"))
  .participant("order-pool", { name: "Order with a bank", processId: "order" })
  .participant("bank-pool", { name: "Bank", processId: "bank" })
  .messageFlow("payment", { source: "pay", target: "bank-pool", name: "Payment" })
  .messageFlow("confirmation", { source: "bank-pool", target: "wait", name: "Confirmation" })
  .build()

Ad-hoc, AI agent, note and doc

An adhoc node is an ad-hoc sub-process: an AI agent that chooses among its tools. A tool is a task with inside=<agent id> and no flows of its own. doc is the description the agent chooses a tool by. note annotates a node.

Agent with a toolBPMN process diagram. Steps: Question asked, Answer with tools, Answered.Answer with toolsLook upusersPicks a tool by itsdescriptionQuestion askedAnswered
const defs = Bpmn.createProcess("agent-process")
  .name("Agent with a tool")
  .startEvent("ask", { name: "Question asked" })
  .adHocSubProcess(
    "agent",
    (sub) => sub.serviceTask("users", { name: "Look up users", taskType: "lookup-users", documentation: "Returns the list of sample users" }),
    { name: "Answer with tools" },
  )
  .annotate("agent", "Picks a tool by its description")
  .endEvent("done", { name: "Answered" })
  .build()

Not in Text: Fluent only

BPMN Kit Text has no word for these. Draw them with BPMN Kit Fluent, or add them in the editor.

ElementFluent
Sub-process.subProcess(id, (s) => …, options?)
Event sub-process.eventSubProcess(id, …)
Transaction.transaction(id, …)
Data object, data store.dataObject, .dataObjectReference, .dataStoreReference, .dataAssociation
Complex gateway.complexGateway(id, options?)

Cheat sheet

PartWords
Kindsstart end task user service rule send receive script manual call xor and or eventgw catch throw boundary adhoc
Aliasesevent parallel exclusive gateway inclusive decision dmn human
Triggerstimer message signal error escalation terminate conditional compensate link cancel
Branchgw >(Label: FEEL) next · gw >(Label: default) next
Job and datajob= result= feel= (last) form= called= each= in.x= out.x=
Eventsmsg= key= signal= error= escalation= at= every= after= on= nonint
Extra lineslane id[Name]: a, b · pool id[Name] · msg a >(Label) b · note id: text · doc id: text