🚀 Welcome to MDriven Learn –  Don’t miss the latest Release Notes.
OCLOperators ViewModelName

Returns the name of a ViewModel. ViewModelName is available within the context of a ViewModel.

selfVM.ViewModelName

Purpose:

It prevents mistakes when ViewModels are renamed.

It ensures that logic always knows the correct ViewModel name.

It works consistently across all ViewModels.

It does not depend on fragile strings.

It helps with debugging by showing the active ViewModel.


Example:

To log a ViewModel opened by a user:

Logger.Log('Opened ViewModel: ' + selfVM.ViewModelName)

If the user opened OrderSummaryVM, the log becomes:

Opened ViewModel: OrderSummaryVM

If the ViewModel is renamed to OrderSummaryPage, the expression returns the new name automatically.

See also: