🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
Action names
This page was created by Stephanie on 2023-06-05. Last edited by Wikiadmin on 2026-07-29.

You use an action's Name as its unique model identifier and its Presentation as the text users see in an action menu or in the MDriven Prototype action column.

Name and Presentation

When you declare an action, you provide these two properties:

Property Purpose Requirement Example
Name Identifies and references the action in the model. Required and globally unique among actions. ApproveOrder
Presentation Provides the text displayed to the user in a context menu or in the MDriven Prototype left-side action column. Defaults to the action Name. You can replace it with user-facing text or context-dependent text. Approve order

Keep the Name stable and technical enough to identify the action unambiguously. Use Presentation to make the command understandable in the user interface.

For example, an action can have the following values:

Property Value
Name ApproveOrder
Presentation Approve order

The action is still referenced by ApproveOrder, while the user sees Approve order.

Include information from the current object

For a Class action, the action has a context object: the object on which the action operates. In Presentation text, use this shorthand to insert an attribute value from that object:

<AsString:attributeX>

Replace attributeX with an attribute on the action's class.

For example, if a Class action operates on an Order object with an attribute named OrderNumber, set Presentation to:

Approve order <AsString:OrderNumber>

When the action is presented for an order whose number is SO-1042, the presentation can show:

Approve order SO-1042

Use this form only when the action has an object context. It is intended for Class actions, where the current object supplies the attribute value. A Global action is not rooted in a specific object, so it does not provide such an object context.

Use context-aware text in constraint descriptions

You can also use <AsString:attributeX> in a constraint Description. This lets the description identify the object that violates the constraint.

For example, a constraint on an Order can use this Description text:

Order <AsString:OrderNumber> cannot be approved before it has a customer.

The resulting message can identify the relevant order instead of showing the same generic message for every object.

Use a derived attribute for complex values

The <AsString:...> shorthand is suited to referencing an attribute. If the text requires a complex expression, such as navigation to attributes on associated objects, define that value as a derived attribute first. Reference the derived attribute from the Presentation or constraint Description.

For example, instead of putting association navigation into a description, define a derived attribute on Order that produces the customer display value. Then use:

Order <AsString:CustomerDisplayName> requires approval.

This keeps the presentation text readable and places the calculation in the model where you can maintain it.

Verify the result

  1. Create or select an object for the Class action.
  2. Set the action Presentation to text that includes <AsString:attributeX>.
  3. Save the model.
  4. Start or refresh MDriven Prototyping.
  5. Select the object and inspect the action in the left-side action column or context menu.
  6. Trigger a violated constraint and confirm that its Description shows the expected object-specific value.

If the displayed value is not what you expect, confirm that the referenced attribute belongs to the class that provides the Class action context. For action availability and placement in a ViewModel, see Training:Available Actions. For action behavior, such as executing expressions or opening a ViewModel, see Training:What an Action can do.

See also