Business Process Generator

Describe a process as actions, wait nodes, and end states -- get the process-definition XML, action classes, Spring beans, items.xml, and localized properties, plus a live flow diagram.

🔒 Your code never leaves your browser — everything is generated locally from templates, no AI, no server round-trip.

  • Process name is required.
  • Add at least one action or wait node.
  • Add at least one end node -- a process must terminate.
  • Pick which node the process starts at.
Becomes the OrderCancelProcess item type and process-definition file name.

Process model extra attributes

Actions

Wait nodes

End nodes

Flow diagram

STARTstart
OK → (not set)
trainingcore/resources/processes/myProcess-process.xml
1
2
3
4
5
6
7
8
9
10
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="http://www.hybris.de/xsd/processdefinition"
                     name="myProcessProcess" start="start">

    <start name="start">
        <transition name="OK" to="???"/>
    </start>

</process-definition>
Generated scaffold. Review and test before using in production.
Advertisement

What is a Business Process in SAP Commerce?

A Business Process in SAP Commerce (Hybris) is a state machine defined in an XML process-definition: a graph of actions, wait nodes, and end states, wired together by named transitions. The platform's process engine persists which node a running instance is on, so a process can span hours or days (e.g. waiting on a payment gateway callback) and survive a server restart.

Each action node delegates to a Spring-managed Java class (an AbstractSimpleDecisionAction for branching logic, or an AbstractProceduralAction for a single linear step), and the process itself is backed by a custom item type extending BusinessProcess so Backoffice's Business Process Monitoring can track running instances.

When to use it

Use a Business Process for any multi-step workflow that needs to pause and resume -- order fulfillment, returns/cancellation flows, approval chains, or anything that waits on an external event (a payment confirmation, a warehouse callback) before continuing.

If a task is a single, self-contained unit of work with no branching or waiting, a CronJob is usually simpler. Reach for a Business Process once the workflow needs multiple steps, a decision point, or a wait on an asynchronous event.

Files generated

  • The process-definition XML (<process>-process.xml) with start, action, wait, and end nodes and their transitions.
  • One Java action class per configured action, extending AbstractSimpleDecisionAction or AbstractProceduralAction.
  • A Spring XML registering the process-definition resource and each action bean (parent="abstractAction", scope="prototype").
  • An items.xml snippet for the process item type, extending BusinessProcess.
  • Localized status properties (<ext>-locales_en.properties) for the process, its actions, and its end states.

Step-by-step: how to use the output

  1. Copy the process-definition XML into <extension>/resources/processes/ and the action classes into <extension>/src/<package>/process/actions/.
  2. Merge the generated Spring beans into your extension's -spring.xml and the items.xml snippet into your extension's -items.xml, then run an update.
  3. Start an instance from code via businessProcessService.createProcess(code, "<process-definition name>") followed by businessProcessService.startProcess(process) -- usually triggered from an event listener (see the Event Listener Generator).
  4. Watch it run in Backoffice's Business Process Monitoring cockpit, and resume a waiting instance by publishing the wait node's event through the process event mechanism.

Common mistakes

  • Giving a decision action only an OK transition -- AbstractSimpleDecisionAction always needs both OK and NOK targets, or the process gets stuck when the NOK branch is taken.
  • Forgetting that a wait node's "then" is a single default target, not a branch -- if the wait needs to branch on different outcomes, model it as a decision action after the wait fires, not inside the wait itself.
  • Pointing a transition at a node name that doesn't exist in the definition -- the process engine only validates this at runtime (or not at all until it hits that transition), so typos surface late.
  • Not registering the process-definition resource bean -- the XML file alone does nothing until something is a bean that points at it (classpath:/.../processes/....xml).

Frequently asked questions

How do I start a Business Process from code?

Inject BusinessProcessService, call createProcess(processCode, processDefinitionName) to get a ProcessModel, set any context attributes on it, then call startProcess(process). Typically this is done inside an AbstractEventListener's onEvent() in response to a domain event.

What's the difference between AbstractSimpleDecisionAction and AbstractProceduralAction?

AbstractSimpleDecisionAction branches: executeAction() returns Transition.OK or Transition.NOK and the process-definition needs both transitions wired for that action. AbstractProceduralAction is a single linear step -- executeAction() returns void and calls setTransition(Transition.OK) once it's done, so only one outgoing transition is needed.

How does a wait node get resumed?

A wait node pauses the process until a matching process event is received. Something elsewhere in the system (often an event listener) looks up the waiting process instance and publishes the named event to it, which resumes the process along the wait node's "then" transition.

Do I need a custom process item type?

Yes for anything beyond the most trivial process -- a type extending BusinessProcess is what Backoffice's Business Process Monitoring cockpit tracks, and it's where you'd add any context attributes (like a cancellation reason) the process needs to carry between actions.

Can a process-definition be changed while instances are running?

Changing the XML only affects processes created after the change -- a running instance keeps following the definition it was started with. Plan schema/flow changes with that in mind, especially for long-running processes.

🗳️ Vote for the next SAP Commerce guide

Vote or suggest a topic
What should we write next? Vote