board logo
Posted by: WUICTeam - Saturday, November 14, 2026 9:00:49 AM
[b]Question[/b] In an action callback I call [c]wtoolbox.navigateToNextStep(record, null, esito)[/c] and want to run a fallback when the workflow does not navigate. I wrote [c]if (!wtoolbox.navigateToNextStep(...))[/c], but when a condition guard fails the fallback never runs and the user just sees a warning. What is going on, and how should the check be written? [b]Answer[/b] The method has three outcomes, not two: [c]true[/c], [c]false[/c] and the string [c]'blocked'[/c]. Because [c]'blocked'[/c] is a non-empty string it is truthy, so [c]!result[/c] is false when a guard stops the navigation. That is intentional: the fallback would otherwise let the callback bypass a block that the graph imposed. [list] [*][c]true[/c]: a target step was resolved and the navigation started. [*][c]false[/c]: there is no active workflow link for this action (no workflow context, or no outgoing links in the graph). Here a fallback makes sense. [*][c]'blocked'[/c]: links exist, but no branch can be taken because guards or permissions are not satisfied. The user already sees a warning with the failed expression and nothing is navigated. [/list] So compare explicitly against [c]false[/c]: [code] const esito = await wtoolbox.dataService.update(entity, row, datasource); const nav = wtoolbox.navigateToNextStep(record, null, esito); if (nav === false) { // no workflow link for this action: do the hardcoded behavior wtoolbox.enqueueNotification({ message: 'No next step configured' }); } // nav === 'blocked': the warning was already shown, do nothing else resolve(esito); [/code] The third argument is the payload exposed to Condition and Switch expressions (for example [c]payload.stato === 'approvato'[/c]). Expressions that mention [c]payload[/c] are not evaluated at the pre-click gate, because the payload does not exist yet: they are applied when the branch is chosen inside [c]navigateToNextStep[/c]. Common mistake: testing the result with [c]!nav[/c] or [c]nav == true[/c] instead of the strict comparisons above. [url=https://wuic-framework.com/docs/workflow-designer]Documentation: Workflow Designer[/url]