🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators RunServerSideViewModelNow
Created by Hans.karlsen on 2018-08-10 · Last edited by Vale.buyondo on 2026-02-14.

RunServerSideViewModelNow forces immediate execution of a named ServerSide ViewModel.

ServerSide ViewModels are normally configured to execute periodically according to a schedule.This operator allows an action to trigger execution immediately, without waiting for the next scheduled run.

ServerSideViewModels are implemented by the MDrivenServer. They are often used to synchronize tasks such as assigning a new sequence number or the like. Often, the pattern is that the Client sets a state that the ServerSideViewModel finds with the ServerSide PS Criteria and then executes actions and saves.

The Client waits for this to happen and issues a selfVM.Refresh to get the new data.

Since ServerSideViewModels are polled with a defined interval (periodicity), the wait for the Client may be longer than optimal for user experience.

Syntax

selfVM.RunServerSideViewModelNow('<ServerSideViewModelName>')

Example

Use this call to influence the server to check for execution need as soon as possible instead of waiting for the interval period:

selfVM.Save; 
selfVM.RunServerSideViewModelNow( SomeClass.ViewModels.SomeServerSideViewModelWeWaitFor ); 
selfVM.Refresh