OCLOperators ViewModelName
Created by Charles on 2024-09-21 · Last edited by Sandra.akech on 2025-12-12.
Returns the name of a ViewModel. ViewModelName is available within the context of a ViewModel.
selfVM.ViewModelNamePurpose:
To prevent mistakes when ViewModels are renamed.
To ensure logic always knows the correct ViewModel name.
To work consistently across all ViewModels.
Does not depend on fragile strings.
To help 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: OrderSummaryVMIf the ViewModel is renamed to OrderSummaryPage, the expression returns the new name automatically.
