You can repair a model that reports Action must have a name by locating and deleting orphaned unnamed actions in the MDriven Designer model debugger.
Why this error occurs
An action must have a name. The action name is globally unique and is used both as the action reference name and, by default, its displayed presentation text. See Training:Action names for action naming and presentation behavior.
This error usually means that an action was left in the model without its owning context. For example, a class may have been deleted while a class action that belonged to it remained. Class actions normally belong to and use an instance of their class as context.
Remove unnamed actions
Before running the repair expression, make sure you are working in the intended model. The expression deletes every action whose Name is null or empty.
- In MDriven Designer, right-click an empty area of the diagram background.
- Select Extras â Open model debugger....
- In the model debugger, select an expression and make it an Action. There is normally only one expression available.
- Enter the following expression:
AbstractAction.allInstances->select(aa|aa.Name.isNullOrEmpty).delete- Execute the action by pressing F5 or by using the debugger's execute button.
- Close the model debugger.
- Save the model as usual.
What the repair expression does
The expression finds all instances of AbstractAction, keeps those with a missing or empty Name, and deletes them.
| Expression part | Result |
|---|---|
AbstractAction.allInstances
|
Gets all actions in the model. |
| aa.Name.isNullOrEmpty) | Keeps actions where Name is null or an empty string.
|
delete
|
Deletes the selected unnamed actions. |
For example, if a deleted class leaves behind one action with no name, that action matches the selection and is removed. A named action, such as approveOrder, does not match and is not deleted.
Prevent the error
Give each action a valid, globally unique name when you create it. You can use a separate presentation value when the text shown to users should differ from the technical action name. For example, an action named approveOrder can be presented as Approve order. See Training:Action names.
Use the normal action documentation when configuring actions in a ViewModel or user interface. This page is only for repairing invalid unnamed action records:
