In UML, data that is local to an activity is stored to object nodes. Object nodes reflect Local Variables.

Activities are modeled in activity diagrams. Refer to Modeling Activities for more information on how to create an activity diagram.

Adding Local Variable via the Elements Toolbar

By Dragging it From the Elements Toolbar

Drag out the local variable icon from the elements toolbar.

You can find an overview on all elements that are available for activity diagrams on page Working with the Activity Editor.

To change name and type, switch to the Attributes panel

Refer to Changing the Attributes of Elements on the Activity Diagram for more information on what you can do in the attributes panel.

By Marking a Pin and Dragging it From the Elements Toolbar

Alternatively, you can mark the parameter pin of a call operation to which you want to connect the new local variable. Then click the Local Variable icon in the elements toolbar, drag out the variable and place it at the desired position.

The newly created local variable is automatically connected to the marked pin and inherits the name and type of the corresponding parameter pin.

Click the image to see an animated version.

Adding Local Variable From the Service Panel

You can also drag out classes, parameters and properties from other Service panel folders, and drop it on the diagram pane.

Name and type of the created new local variable match those of the element dragged out from the Service panel.

Moving and Resizing Local Variables

Once added to the diagram, you can move local variables any time.

Click the local variable and drag it to a new position.

You can resize local variables by clicking the square in the bottom right corner of the element and dragging it.

You can hover over the local variable to see a tooltip showing the full path of the type.