BPMN Diagrams – How To Use Gateways

BPMN Diagram

Business process modeling examples showing how to use the five different gateways defined in the BPMN specification.

Background

We presented an introduction to BPMN diagrams last week. Business analysts are often required to document as-is processes and to-be processes. These diagrams help identify the scope of a software project. The diagrams can also help uncover requirements that might be overlooked without diagramming the processes.

The BPMN specification is designed to establish a common language and convention for creating process diagrams. This common convention allows people who are familiar with modeling, but new to a project to avoid learning a new diagramming language on each project or for each client. We have a link to the official version of the spec in our introductory post (we will update that link if and when the spec changes).

Gateways

Gateways are the evolution of the diamond-shaped boxes we’re accustomed to in flow charts. In BPMN, gateways can have one of five distinct interpretations. The gateways are used in diagrams both to separate flows and to recombine them.

  • Exclusive OR (XOR) Decision/Merge based on data
  • Exclusive OR (XOR) Decision/Merge based on an event
  • Inclusive OR (OR) Decisions/Merge
  • Complex Decision/Merge
  • Parallel Fork/Join

BPMN Gateway Legend

Exclusive OR (XOR)

An exclusive OR, which logicians call XOR, represents a decision to take exactly one path in the flow. More than one path can not be taken – they are mutually exclusive, hence the name. This is the behavior generally assigned to the familiar diamond from flow charting.

Data based XOR Gateway

The first thing to note is that this gateway can be drawn in either of two ways. It can be drawn as an empty diamond, or as a diamond with an ‘X’ in it. Whatever style is chosen, it should be consistent within the diagram and all diagrams. We prefer to use the diamond with the ‘X’ in it.

BPMN diagram example of data based XOR

In our business process modeling example above, after opening the mail, the person will either read the mail (and then discard it), or discard it without reading it. The first gateway represents the choice based on data available in the process. The available data is the content of the mail (either junk or real).

The second gateway is optional. We also could have drawn the diagram as follows:

Alt BPMN Diagram Example of data based XOR

Event Based XOR Gateway

When an event, such as an external message, causes us to make an exclusive OR (XOR) decision, we use a different XOR gateway. The distinction is if the information required to make the decision is available within the process (use data based) or comes from an external source (use event based). This will make more sense when we consider the example business process model.

BPMN Diagram example of event based xor

In this business process modeling example, our actor invites a girl to the prom. If her response, a message that is external to the process, is yes, the actor rents a tuxedo and attends the prom. If she says no, he will stay home and play XBOX games all night.

We could also have modeled this by bringing the girl’s response into the process as data. Once it is in the process, we would use a data based XOR gateway, as shown in the following example.

Another BPMN Diagram example of a data based xor

This alternative approach, while potentially easier to read, is also more verbose (Adding an extra task to the process). Either style is acceptable in the BPMN official spec. We suggest using the event based gateway for a cleaner diagram.

Inclusive OR Gateway

An inclusive OR Gateway specifies that one or more of the available paths will be taken. They could all be taken, or only one of them.

BPMN Diagram example of inclusive or gateway

In this example of a business process model, our actor purchases a car. After that purchase, if the car needs to be cleaned, it will be cleaned. Also, if it needs to be repaired, it will be repaired. If the car needs to be both cleaned and repaired, both things happen. The possibility that neither a cleaning nor repairs are required.

The first OR gateway represents the control of the flow of the process along one or more paths in the model. The second OR gateway represents the reconnection of those paths and the continuation of flow. When reconnecting paths like this, the OR gateway explicitly requires that all paths that were activated must be completed prior to continuing in the process.

By explanation, if the car needed only to be cleaned, then the car may be driven once the cleaning is done. If the car needed to be both cleaned and repaired, the car could not be driven until both the cleaning and repairs were completed.

Complex Decision Gateway

A complex decision gateway allows for a more expressive decision within a business process. Multiple factors, rules and analyses can all combine to yield results. The analysis should result in at least one path always being taken.

BPMN Diagram example of a complex decision gateway

In this business process modeling example, our student takes the SAT (a college entrance/aptitude exam common in the USA). If the student scores under an 800 (the possible scores range from 200 to 1600), the student will enroll in an expensive class to improve his test score – and then retake the exam. If the student performs moderately, he will read a low-cost book designed to help him improve his score – and then retake the exam. If the student scores above 1000, he will immediately attend university.

Parallel Gateway

A parallel gateway (also called a fork, or join) is used when a process can perform multiple branches of operation in parallel.

BPMN Diagram example of a parallel gateway

In this business process modeling example, our inventor invents a better mousetrap. The process flow then splits (forks) into two parallel paths. Along one path, the inventor files for a patent. In the other branch, the inventor creates a prototype. Once both of those steps have been completed, the inventor gets rich.

A fork gateway (the first one) explicitly states that all paths must be followed. A join gateway (the second one) explicitly requires that all paths have been completed before advancing the process. Our inventor can not get rich without a patent, and also can not get rich without a prototype.

Summary

We now know how to use the five different types of gateways in our business process modeling diagrams. We should use the BPMN diagramming standard to make our diagrams consistent within and across projects.

15 thoughts on “BPMN Diagrams – How To Use Gateways

  1. The complex gateway example looks like an exclusive-or gateway to me. The three conditions are mutually exclusive, and there are no other possible conditions (unless you were thinking of something else).

    If I’m wrong, please say why, or provide a better example of the use of a complex gateway.

  2. The complex gateway is not easy to understand. In the example in this article it really is described as an exclusive OR (XOR). But usually it is described similar to the inclusive decision (OR) by telling that at least one path should be selected (one or more paths). I really do not (yet) see how the complex gateway is supposed to be used.

    1. I use a single complex decision point in cases where I want to do A, B, and C, and sometimes I want to do D. I think it’s easier to read than an inclusive OR that goes to A, to B, to C, and to an exclusive OR that either does D or nothing.

    1. Thanks, Felice! I really appreciate you pointing this out for folks. Frankly, I haven’t used BPMN in quite some time, so your clarification here will _definitely_ help people who find this article.

  3. Pingback: Radyan Yudha B.
  4. Hi,
    The usability of a complex gateway is very rare as a divergent element. Theoretically, this gateway is used when we have a situation that include a lot of variables and previous events that will generate problems during the process EXECUTION in real time (by a BPMS). Therefore it lacks of readability in a BPMN diagram. With this I mean that does not matter how much information you include to support it, It always looks like is possible to solve the problem using other gateways. However, the use of this gateway as a Convergent element is really interesting because you can synchronize a lot of possibilities (branches or flows) that can occur and return control to the flow again. Please read the “N out of M Join pattern” of Wil van der Aalst

    1. Thanks for the comment, and welcome to Tyner Blain, Ruben!

      I know that the BPMN spec, and I’m sure best practice for using it, has evolved since I wrote this series of articles. Unfortunately, I haven’t been (and don’t appear likely to be) working with BPMN for quite a while.

      I’m sure other folks that find this article will benefit from your comments below – thanks for helping them out!

      Scott

  5. Pingback: Brian Steuhl
  6. Hi,

    I am new to BPMN and would like to know the Inclusive OR merge gateway in details.

    Scenario 1: If I have a parallel split and all the tokens are coming into Inclusive merge, will it wait for all tokens to merge and go through or the first token will go through and then the next token will go through.

    Scenario 2: If I have a Inclusive OR split which divides the token to 3 parts and all are true, and later down the workflow I have a inclusive merge which gets only one of the tokens as all others meet logical end, then will the token pass through the gateway or it keeps waiting for other tokens.

    1. Thanks for your questions, Kaushik. Unfortunately, I haven’t done any BPM work since shortly after writing this series. I’d take a look at Bruce Silver’s site / book / training. I believe the BPMN standards have even changed at least once since I created these. http://brsilver.com/ is Mr. Silver’s site. Best of luck with it, sorry I can’t be more helpful!

  7. For the OR gateway, do we have to explicitly draw the line that indicates no choice will be taken?

    Also, in general, does the OR gateway implicitly include the NONE choice, i.e. we neither clean nor repair the car. What’s the little hash mark drawn on a sequence connector (solid line with arrow)? (Does it mean default choice?).

    1. Bruce, thanks for the great question. Disclaimer – I haven’t done any BPMN work in years.

      I believe for the diagram to be explicitly clear that “no choice” is a viable option (think check-box vs. radio-button), you must include the “none” choice. The goal of BPMN is to avoid ambiguity. I would expect that a diagram which says “here’s the flow, but there are possibilities that are perfectly fine, but not shown” would be a broken diagram.

      I don’t remember if the hash mark defines the default choice, sorry. Also, I know the spec has been updated since this article was written (but I have not read the updated spec, since I haven’t done any BPMN diagramming for years) – so please check that to be sure.

      Thanks, hope I was some help.

Leave a Reply

Your email address will not be published. Required fields are marked *