To refresh our memories, an element is the smallest unit of a flow. Elements are the building blocks we combine to build our apps. Examples of elements include steps, pages, values, service elements, navigation elements, etc.
We can identify individual elements by their ID and developer name from the metadata. Elements also have labels; we will come to that in a minute.
The Flow engine generates a universally unique identifier (UUID) for each element. This ID remains the same throughout the lifecycle of the flow. As we can imagine, if we delete the element, the ID is deleted along with it. We can also add an element back manually by its ID.
We are prompted to add a name as we create an element; this name shows up as developerName in the metadata. We enter the element name in the configuration panel that opens when we drag an element to the canvas. The ‘Name’ is a required field, and is used as a reference in the Flow API. While the ID is unique to every instance of an element, we can have the same developer name more than once. For example, if we create two steps with the same name, both the steps will have the same developer name.
Let’s try dragging a step element.
We will name the step ‘Awesome’ and pull up the element metadata (by pressing shift and left-clicking on the element).
We want to follow a naming convention when when working with page layouts. If we repeat the developerName of a component or container, the logic may suffer. It is best to use short descriptive names.
The label is what the end-user sees in an app. Multiple elements can have the same label. For example, we can have multiple outcomes with the label ‘Next’. Labels are therefore neither unique, nor reliable identifiers.
What is perhaps even more relevant, is that not all elements need or have labels. We use labels for outcomes and page layouts only. The outcome connecting the Start element to the first element of the flow does not need a label either, as the user sees the first element directly when she runs the app.
The Name and Label can be the same, or different, based on our requirements and the naming convention we follow. Like ID or developer name, the label is also a required field where used.
- Creating outcomes
- Creating a page layout
- Editing the metadata of an element
- Name and Label vs. Name in Outcome