Skip to main content
Skip table of contents

Master Data Preparation (Create Kanban Loop)

Our very first task is to build an initialization flow. We need a way for users to create a new Kanban Loop and define its production routing (the sequence of production lines the cards will pass through).

To do this the right way, we are going to learn one of the most powerful concepts in P4: Subprocesses. Instead of putting all the logic into one giant flow, we will create a small, reusable "helper" flow first, and then call it from our main flow.

Part A: The Helper Flow (Create Loop-Line Relation)

Since linking a production line to a Kanban loop might be a standard action we want to reuse in the future, we will build it as a separate subprocess.

  1. Navigate to Configuration Studio ➔ Process Builder ➔ Flows and click New.

  2. Name it Create Loop-Line Relation.

In this flow we will have 3 nodes: Start - Create object - End

image-20260310-101914.png

Step 1: The Start Node (Inputs)

Double-Click on the Start node. This helper flow needs three pieces of information to do its job. Add the following Input Variables:

  • Kanban_Loop (Type: Number)

  • Production_Line (Type: Number)

  • Position (Type: Number)

image-20260310-102016.png

Step 2: Create the Relation

Add a Create Object node and connect it to the Start node. Inside it's edit dialogue set the following:

  • Source entity: Select KANBAN_PROD_LINE_REL (the custom entity we made in Part 1).

  • Properties: Use the DataStore (the small icon next to the value field) to map your three input variables (Kanban_Loop, Position, Production_Line) directly into the entity.

image-20260310-102049.png

Step 3: End and Publish

Connect the Create node to an End node. Crucial Step: Save this process by clicking SAVE AS PUBLISHED. Only published flows can be used as subprocesses by other flows!

Part B: The Main Flow (Create Kanban Loop)

Now, let's build the main flow that the user will actually trigger. Create another new flow and name it Create Kanban Loop. It might look like this by the end of this part.

image-20260310-104205.png

Step 1: The Start Node

In the Start node, define the data the user will provide:

  • ID_MATERIAL (Type: Number)

  • Batch_Size (Type: Number)

  • Number_of_kanbans_in_loop (Type: Number)

  • Kanban_Card_Capacity (Type: Number)

  • PRODUCTION_LINE (Type: Array)

(Tip: For testing, you can put a simple JSON array of line IDs into the default value of the PRODUCTION_LINE variable).

JSON
{ 
  "production_lines": [ 
    { 
      "id": 1562
    }, 
    { 
      "id": 1581
    }, 
    { 
      "id": 1681
    } 
  ] 
}
image-20260310-091924.png

Step 2: Create the Loop

Add a Create Object node.

image-20260313-141142.png
  • Source entity: KANBAN_LOOP

  • Map the Batch_Size, Material, and Number_of_cards from the Start node variables. Set Active to a static value of 1.

image-20260310-092800.png

Step 3: Set Up the Loop Node

We need to iterate through the array of Production Lines.

image-20260313-141210.png
  • Add a Loop node and name it Line Relations.

  • Type: Foreach.

  • Data source: Select the PRODUCTION_LINE array from the Start node.

image-20260310-094845.png

Step 4: Track the Position (Variable Assignment)

In the right-hand panel of the Flow Builder, create a Process Variable called Position (Type: Number, Default value: 0).

image-20260310-095444.png
image-20260310-095827.png

Inside the Loop, add a Variable assignment node:

image-20260313-141250.png
  • Select the Position variable.

  • Set its value using this simple expression to increase it by 1 every cycle: add({{datastore.variables.Position}}, 1)

image-20260310-100153.png

Step 5: Call the Subprocess

Still inside the loop, add a Subprocess node and connect it after the Variable assignment.

image-20260313-141600.png
  • Select your published Create Loop-Line Relation flow.

  • The system will automatically ask you to provide the inputs for this helper flow:

    • Kanban_Loop: Select the ID generated by your first Create Kanban Loop node.

    • Production_Line: Select item.id from your Line Relations loop node.

    • Position: Select your newly calculated Position variable.

image-20260310-102547.png

Close the loop by connecting this Subprocess node back to the Loop node.

Step 6: End and Test

Connect the "Out" port of your Loop node to an End node. Here, you can output the CreatedLoop data as an Array so the system knows it finished successfully.

image-20260313-141716.png

Test It with Debugger!

Click Execute Process at the top right.

image-20260310-104449.png

The Debugger will open in a new tab. This is your safe testing environment.

image-20260310-104950.png

Hit the play button at the bottom and watch how your flow creates the loop, iterates through the array, and calls your subprocess.

image-20260310-105302.png

If you scroll lower below the process preview, the current DataStore of the process is for you to review. Go through the whole process, check if everything behaves as expected and if necessary return to the process and change what is needed to achieve your desired result.

image-20260310-105930 (1).png

Next up: ➔ Flow 2: Initializing Kanban Cards

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.