Troubleshooting
Why a Symbolic IO Field Screen Change Needs a Deactivate Script
Short answer
WinCC Unified has no ActivateScreenByNumber, so a Symbolic IO field drives screen navigation through a JavaScript Deactivated event handler: it reads the committed menu tag and calls ChangeScreen with the matching screen name. The event fires only when the field loses focus, and a PLC write never fires it, so controller-driven screen changes use their own tag-event path.

On this page
- Why does WinCC Unified have no ActivateScreenByNumber?
- How does a Symbolic IO field know which screen to open?
- Which event carries the navigation script?
- What does the working Deactivate handler look like?
- How do you prove one mapping on the bench?
- What if the selector never loses focus?
- Why does a PLC write change nothing on the panel?
- What breaks first when navigation does not work?
- Questions asked
WinCC Unified has no ActivateScreenByNumber. To navigate from a Symbolic IO field's numeric menu, attach a JavaScript handler to the field's Deactivated event, read the committed menu tag, and call HMIRuntime.UI.SysFct.ChangeScreen with the destination screen name. The event fires only when the field actually loses focus, so the operator must commit the value and then move focus before anything navigates, and a PLC write never fires it at all. Below is the working handler, a bench test that proves one mapping end to end, the disable workaround for a selector that will not release focus, and the check order that separates a missing event from a wrong destination.
Why does WinCC Unified have no ActivateScreenByNumber? #
Unified has no ActivateScreenByNumber: the documented ChangeScreen function loads a new screen into a screen window by name, so the number-driven function you knew from classic WinCC projects must be rebuilt as your own number-to-name mapping.
The classic behavior is real and still documented in the modernization notes: that function navigated to a screen by its assigned screen number, commonly for dynamic navigation. On a Unified runtime the pattern survives, but the translation step becomes yours. The runtime never assigns meaning to 0, 1 or 2; your table does. Classic WinCC put its own trap on the numeric route, a page number aimed at a screen map that did not hold that entry, and the same discipline applies here — see why a WinCC I/O field page number needs a valid screen map.
Decision: the number-to-name table lives in your project and nowhere else, so every entry in it is something you commission and test.
How does a Symbolic IO field know which screen to open? #
It never does on its own: the field writes only your chosen value into the linked tag, and that number becomes a destination when your script maps it, so entries 0 through 5 select six screens purely because the switch statement says so.
Connect the field's value to one tag — MenuNumber in the working example — and let a text list supply the operator-facing entries. The documented text-list features cover the display side, including nested text lists and parameter fields assigned to an HMI tag; none of that opens a screen. Keep the displayed wording separate from the destination names, so rewording a menu entry never silently moves the navigation target. The numbers are your own selection codes, not screen numbers the runtime knows.
| MenuNumber value | Destination screen name | Commissioning check |
|---|---|---|
| 0 | 00_Main |
screen exists under this exact name |
| 1 | 01_Steering |
screen exists under this exact name |
| 2 | 02_EngineDiag |
screen exists under this exact name |
| 3 | 03_Alarms |
screen exists under this exact name |
| 4 | 04_UserMngmnt |
screen exists under this exact name |
| 5 | 05_Utilities |
screen exists under this exact name |
Those names come from a working implementation and are examples; your table must carry your project's names, character for character, punctuation included.
Which event carries the navigation script? #
Put it on the field's Deactivated event, which the runtime triggers when you take focus off the object by activating a different one; value chosen, value committed and field deactivated are three separate steps, and navigation may start only after the third.
The IO field's documented event set includes Activated and Deactivated, and Deactivated is explicitly the focus event: it fires when focus moves to another object, not when the value changes. Bind the event in the engineering tool so the handler is generated for your actual object — an object named Symbolic IO field_1 yields the function name Symbolic_IO_field_1_OnDeactivated, spaces collapsed to underscores — and keep that generated name. The handler is JavaScript running inside the Unified runtime process on the operator station; the PLC executes none of it, which is laid out further in where JavaScript and WebAssembly actually run on an HMI.
What does the working Deactivate handler look like? #
The handler reads the menu tag once, prints the value to the runtime trace, and switches on the number, calling ChangeScreen with the destination name and the screen window path; here is the working mapping, all six entries plus an empty default.
export function Symbolic_IO_field_1_OnDeactivated(item) {
let tag1 = Tags("MenuNumber");
let tagValue1 = tag1.Read();
HMIRuntime.Trace("value of MenuNumber: " + tagValue1);
switch (tagValue1) {
case 0:
HMIRuntime.UI.SysFct.ChangeScreen("00_Main", "~");
break;
case 1:
HMIRuntime.UI.SysFct.ChangeScreen("01_Steering", "~");
break;
case 2:
HMIRuntime.UI.SysFct.ChangeScreen("02_EngineDiag", "~");
break;
case 3:
HMIRuntime.UI.SysFct.ChangeScreen("03_Alarms", "~");
break;
case 4:
HMIRuntime.UI.SysFct.ChangeScreen("04_UserMngmnt", "~");
break;
case 5:
HMIRuntime.UI.SysFct.ChangeScreen("05_Utilities", "~");
break;
default:
break;
}
}
Three details decide whether that script survives commissioning. The second argument, the tilde in quotes, is the screen window path this implementation used; a correct destination name does not compensate for a wrong target window, so check that path against your own screen window hierarchy before reusing it in nested layouts. The empty default branch navigates nowhere for an unmatched value, which is the behavior you want while entries are still being commissioned. And the two identifiers are different strings on purpose: the generated function name uses underscores, while a Screen.FindItem lookup would need the actual object name, spaces and all.
How do you prove one mapping on the bench? #
Commit one value on the bench, move focus off the field, and check two outputs in order: the trace line with the committed number, then the destination screen open in the target window — one link in the chain at a time.
Worked example, selecting the entry whose value is 2:
- The menu list holds six entries with values 0 through 5, so the handler needs six real cases plus one empty default: 6 + 1 = 7 branches.
- The operator picks that entry; MenuNumber commits as 2.
- The operator taps any other object; Deactivated fires, exactly once.
- The handler reads the tag and prints
value of MenuNumber: 2to the runtime trace. case 2matches the numeric 2 and callsChangeScreen("02_EngineDiag", "~").- The runtime loads 02_EngineDiag into the window the tilde path names.
Expected bench result: one trace line and one screen swap per selection, trace first, both tied to the focus move — never to the moment the entry was highlighted.
What if the selector never loses focus? #
Force the deactivation: the working workaround uses a second field's output-format script, triggered by MenuNumber, to set the selector's Enabled property to 0, and disabling the active field provokes the Deactivated event, so the navigation handler runs.
export function IO_field_1_OutputFormat_Trigger(item) {
// Trigger is the tag "MenuNumber"
var value;
Screen.FindItem("Symbolic IO field_1").Enabled = 0;
return value;
}
Four things make that workaround hold. The trigger is a configuration: MenuNumber must be selected as the script's trigger in the tool, and naming the tag in a comment does not configure anything. The variable value is never assigned, so the script returns undefined and the Enabled write is a side effect, not formatting — treat the output-format binding as a disable mechanism, nothing more. The FindItem string must spell the actual object name with its spaces, which is not the same string as the generated handler name. And the parent screen must restore Enabled on load, configured explicitly, or the selector comes back dead the next time that screen opens. If the helper field should stay display-only, an ordinary IO field's mode is set to Output under Properties > General > Mode.
Use this only where the operator can realistically park focus in the selector; otherwise plain commit-then-focus is the simpler, testable path.
Why does a PLC write change nothing on the panel? #
A PLC write updates tag data and never takes focus off an object, so the Deactivated handler does not run and the screen stays; local operator success with this workaround proves nothing about controller-driven navigation, which needs its own trigger path.
Test the external request as its own case: selector untouched, parent screen not even open, PLC writes the request, screen changes. If it works only while an operator is mid-selection, the design is leaning on focus, and it will fail in production exactly when nobody stands at the panel. The documented route for controller-driven changes is the PLC screen-change mechanism — the one behind change the HMI screen from the PLC in WinCC Unified — and it replaces the focus event with a tag event the runtime watches. Decision: two sources of navigation get two paths and two acceptance tests, and the Deactivate bench test never qualifies a PLC request.
What breaks first when navigation does not work? #
Diagnose in execution order — committed tag value, trigger, deactivation, script branch, window target — and fix the first broken link, because renaming screens repeatedly will not repair a missing Deactivated event.
Work down this list; the first line that matches is where the chain is broken:
- No trace line at all: the Deactivated handler is not bound to the object you are testing, or the interaction never moved focus. Bind the event in the tool and repeat the test with a deliberate tap on a second object.
- Trace prints the previous selection: the new value was not committed before the handler read the tag, so check the field's commit behavior on leaving the field.
- Trace prints the right value and no screen opens: the branch target is wrong — numeric case labels, exact destination name, correct window path, in that order.
- Selector stays disabled after returning to the screen: the parent screen's load action is not restoring Enabled.
- Operator path works, PLC path does not: expected, not a fault in the handler; the PLC request needs the controller-driven path.
One safety note belongs here: a focus event is a comfort trigger, so never let it be the only route to an alarm or interlock screen — a field that never loses focus never navigates, and alarm display must survive that.
The decisions: for an operator-driven numeric menu on a Unified panel, ship the Deactivated handler with the number-to-name switch and prove it with commit-then-focus on the bench; for controller-driven changes, ship the PLC screen-change path and keep this handler out of it.
Questions asked
Can one handler open screens in two different screen windows?
Yes. ChangeScreen loads the new screen into the screen window given by its second argument; the working example passes a tilde because its project uses one window. For a nested layout, give each case the window path configured in your own project, and test each branch, because the runtime checks the destination name and the window separately.
Can a text list do the navigation without any script?
No. The documented text-list features cover what the operator sees, including nested lists and parameter fields assigned to an HMI tag, but a text list only maps values to displayed text. Opening a screen still needs a scripted event on the panel, or the controller-driven screen change path when the request comes from the PLC.
Why does the switch never match a value the trace prints correctly?
Check the JavaScript type before anything else. A case label written as the number 2 matches only the numeric value 2, and text holding the same digits never matches it. Make the case labels and the tag value the same type, then retest the same selection while watching the trace.
Can a push button open a screen the same way?
Yes. Any scripted event can call the same system function, so a button opens its fixed destination with one ChangeScreen call and no mapping at all. Keep the Symbolic IO field pattern for the case where the operator's menu choice decides the destination, and point both at the same screen names so the project holds one source of truth.


