Saving workflow rejection paths | bpmn-js

プログラミング・Web開発カテゴリを表すパンダのイラスト Programming / Web Development

About this article
This article was created using an automated generation flow utilizing generative AI. Implementation was verified against official documentation and fixed training materials, and operational and technical constraints were organized.

Verification status: 📘 Official information and implementation cross-check. Browser hardware verification not performed.

When rejecting an application, it is necessary to indicate who must redo the steps. Connect two boxes, convert the diagram to XML and reload it to verify the return destination. Persistent storage to a file is not performed.

Open live demo

Terms to know first

  • BPMNis a standard for representing business procedures using common symbols.

  • XMLis a format for representing data using elements and attributes.

Thinking in flowcharts

Look for the arrow returning from review to application. You can examine what is returned to the form filler.

flowchart TD
    A["申請"] --> B["確認"]
    B -- "差し戻し" --> A

Live demo operations

Double-click the Application shape in the diagram to edit it. Click save and reload.

How to interpret the results

Expect names and rejection paths to be restored.

Verify where the rejection line returns. Check whether the return destination and labels are maintained even after saving and reopening the diagram.

Key code points

Use saveXML to convert the diagram currently being edited into XML. Reload it using importXML and verify the diagram display and the exported result.

The implementation can be checked in the Implementation Code section of the demo screen.

When Using for Work

Align the scope of symbols to be used with the person responsible for receiving the saved file.

Verifying the Generated Diagram

Clicking the execute button is expected to generate elements such as a start event, an application, a review, and the connecting lines between them. The label on the line connecting review back to application is rejection. First, verify the direction of this line. Next, double-click the task name application and change it to revised application. Click save and reload to check if the modified name and return line are displayed again. Since the XML is displayed in the results column, check the name and connection information as well.

The actual code in this tutorial does not include nodes that proceed to approval or completion. Therefore, rather than a diagram completing all branches of an actual application process, this is a minimal example to learn connections with return targets and how to save edits. The diagram above is also a conceptual diagram focusing on the return line. When designing formal business procedures, it is necessary to separately add approval conditions, completion conditions, and assignees.

Handling Shapes and Connections Separately

The bpmn-js Modeler provides a mechanism to edit BPMN diagrams in the browser. In this implementation, createDiagram creates the initial diagram, and elementFactory is used to create task shapes. modeling.appendShape is used to add shapes along with connections. Furthermore, create a connection from review to application and use updateLabel to assign the name rejection. In this way, you not only draw boxes, but also handle relationships such as which box transitions to which box.

Even if the box names are the same, if the direction of the connection is reversed, the meaning changes. When reviewing the return destination, check not only the label but also the start and end points of the arrow. After zooming in on the diagram to check the direction of the lines, also examine the reference relationships in elements such as sequenceFlow in the XML. Since diagram elements have identifiers separate from their names, changing the label does not mean a new task has been added.

Distinguishing Between XML Export and Saving

The save and reload button converts the current diagram to a string using saveXML and passes that string to importXML to reload it. Furthermore, the display range is adjusted to fit within the screen. This is an experiment in bouncing data back and forth within the same screen. It does not include processing to download files to the user's device or recording them to a server. There is no guarantee that edits will remain after closing the screen.

If you are sharing XML files in actual business design, prepare processing to save them as files, a method for versioning, and ensure that the recipient can open them in a different environment. It is easier to verify by comparing the diagram before saving and the diagram opened from the saved XML in a new editing screen. A method that saves only the display as an image may not preserve the connection information required for re-editing.

To Complete as a Business Flow

In production operations, determine the reason for rejection, the person responsible for re-applying, and the conditions for ending the process. The return line here illustrates an example of a connection among those. Drawing a diagram in BPMN is different from automatically executing operations with a workflow engine. If branching condition formulas, permissions, or exception handling are required, consider them according to the specifications of the execution environment being used.

If the diagram is not displayed, check the acquisition status of modules, CSS, and BPMN fonts. If the initial diagram is displayed but only editing or reloading fails, distinguish between operational errors and XML errors. Public tutorials should use hypothetical operations without including actual organization names, internal approval paths, or personal names.

Verification Scope

Target of tutorial: bpmn-js 18.3.1. Static verification of fixed HTML createDiagram, appendShape, connect, updateLabel, saveXML to importXML. Execution of modeler, XML generation, and reloading is unverified. Acquisition of external CDN, fixed-version license and actual browser display, and Mermaid rendering are unverified.

References

GitHub Samples

Implementation and Experimental Procedures

Document information

Article title
Saving workflow rejection paths | bpmn-js
Published
Updated
Source
https://papanda925.com/?p=19115&lang=en

License: Text and original figures for which this site holds the relevant rights are available under CC BY 4.0 , unless otherwise noted. This article may include content created or edited with generative AI. If code has a separate license notice or a linked GitHub repository license, that license takes precedence for the code. Quotations, third-party materials, images, and trademarks are excluded from this license. Usage policy

Copied title and URL