OCLOperators CanExecuteAction
Created by Hans.karlsen on 2023-03-10 · Last edited by Vale.buyondo on 2025-12-17.
CanExecuteAction is an OCL operator used in MDriven to check whether a given action can be executed within a specific ViewModel nesting before you actually run it with ExecuteAction. It returns a Boolean (true or false)
Syntax
selfVM.CanExecuteAction(nameofNesting, nameofAction) : Boolean
Example
Suppose you have a ViewModel nesting called "OrderList" and an action named "ApproveOrder".
selfVM.CanExecuteAction('OrderList', 'ApproveOrder')
Returns true you can execute the 'ApproveOrder' action now
Returns false you cannot execute it yet (e.g., no order selected or business rule disallows it)
Arguments
nameofnesting: String
Name of ViewModel Nesting.
nameofaction: String
ActionName to check for.
