🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
The VMClassId Explained
This page was created by Hans.karlsen on 2018-09-24. Last edited by Wikiadmin on 2026-07-29.

You use a VMClassId to identify a particular ViewModel class or nesting in a Turnkey runtime message; this page is for developers reading Turnkey JSON or calling remote Turnkey operations.

Format

A VMClassId has two parts separated by a semicolon:

<root-object-external-id>;<ViewModel-class-or-nesting-name>

Part Meaning Example
<root-object-external-id> The ExternalId of the object that roots the ViewModel. If the ViewModel has no root object, this part is $null$. 2!9 or $null$
<ViewModel-class-or-nesting-name> The name of the ViewModel class, or the name of a nesting within that ViewModel, to which the message applies. PersonSeeker or AllCars

For example:

2!9;PersonSeeker

means that the runtime target is the ViewModel class or nesting named PersonSeeker, rooted by the object whose ExternalId is 2!9.

Rooted and unrooted ViewModels

A rooted ViewModel presents information in the context of an object from the model. Its VMClassId starts with that root object's ExternalId.

An unrooted ViewModel has no root object. Its VMClassId starts with $null$.

For example, Turnkey server-stream updates for an unrooted AllCars ViewModel can contain:

{
  "Attribute": "AllCar",
  "UpdateType": "Add",
  "NewValues": [ "5!1;AllCar" ],
  "VMClassId": "$null$;AllCars"
}

In this example, $null$;AllCars identifies the unrooted AllCars ViewModel. The value 5!1;AllCar identifies an item in the AllCar collection: its object ExternalId is 5!1, followed by the relevant ViewModel class or nesting name, AllCar.

Read a VMClassId step by step

  1. Find the semicolon. Everything before it is the root-object part; everything after it is the ViewModel class or nesting name.
  2. Check the root-object part.
    • If it is $null$, the ViewModel is unrooted.
    • Otherwise, interpret it as an ExternalId. For example, 2!9 identifies an object using class index 2 and object id 9.
  3. Use the part after the semicolon to locate the ViewModel class or nesting in MDriven Designer's ViewModel editor.
  4. When inspecting a Turnkey update, use the VMClassId together with fields such as Attribute to determine which ViewModel data the update changes.

Find VMClassIds in Turnkey data

Turnkey runtime messages use JSON to build the data hierarchy designed in the ViewModel editor. Inspect the Turnkey page's debugging output to find the VMClassIds currently used by the page.

Look for a VMClassId property in server-stream update commands. For example, an UpdateCollection message can identify the receiving ViewModel with:

"VMClassId": "$null$;AllCars"

Use the VMClassId from the message, rather than guessing the target from the displayed UI. The server stream and its update-command structure are described in Documentation:Getting safe–limited–meta information from a Turnkey app.

VMClassId and VMId are different

Do not confuse a VMClassId with a VMId.

Identifier Purpose Example
VMClassId Identifies the root-object context and the ViewModel class or nesting within a runtime message. $null$;AllCars
VMId Identifies the server-side ViewModel instance returned when a view is opened. Use it when requesting that instance's server stream. 943a7840-796e-4370-bd37-d407ffa48aa9

For example, opening a Turnkey view can return a value in the form:

943a7840-796e-4370-bd37-d407ffa48aa9¤$null$;AllCars

The value before ¤ is the VMId. The value after it is the VMClassId. See Documentation:Getting safe–limited–meta information from a Turnkey app for the open and server-stream flow.

Use in remote Turnkey operations

Some remote Turnkey OCL operations require the remote VMClassId as an argument. For example, Documentation:OCLOperators RemoteTurnkeySetStringValue accepts a session, remote VMClassId, remote column name, and the string value to set.

Use the VMClassId reported by the remote application for the intended ViewModel class or nesting. A VMClassId identifies the ViewModel target; it is not a substitute for the session or the server-side VMId required by other parts of the remote interaction.

Gotchas

  • The ExternalId part is only the text before the semicolon. Do not treat the entire VMClassId as an ExternalId.
  • $null$ is a valid root-object value. It means that the ViewModel is unrooted; it does not indicate an error.
  • The name after the semicolon is a ViewModel class or nesting name, not a model class name unless your ViewModel uses the same name.
  • An ExternalId that uses a numeric class index can be affected by model changes. Read Documentation:The ExternalId explained before exposing ExternalIds in durable links or external integrations.

See also