{"record":{"id":"61e40d7078119b7a","repo":"OrchardCMS/OrchardCore","slug":"the-syntax-syntax-isn-t-supported-for-setoutputtask","errorCode":null,"errorMessage":"The syntax {Syntax} isn't supported for SetOutputTask.","messagePattern":"The syntax (.+?) isn't supported for SetOutputTask\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/OrchardCore.Modules/OrchardCore.Workflows/Activities/SetOutputTask.cs","lineNumber":61,"sourceCode":"        set => SetProperty(value);\n    }\n\n    public WorkflowScriptSyntax Syntax\n    {\n        get => GetProperty(() => WorkflowScriptSyntax.JavaScript);\n        set => SetProperty(value);\n    }\n\n    public override IEnumerable<Outcome> GetPossibleOutcomes(WorkflowExecutionContext workflowContext, ActivityContext activityContext)\n        => Outcome(S[\"Done\"]);\n\n    public override async Task<ActivityExecutionResult> ExecuteAsync(WorkflowExecutionContext workflowContext, ActivityContext activityContext)\n    {\n        var value = Syntax switch\n        {\n            WorkflowScriptSyntax.Liquid => await _expressionEvaluator.EvaluateAsync(LiquidValue, workflowContext, null),\n            WorkflowScriptSyntax.JavaScript => await _scriptEvaluator.EvaluateAsync(Value, workflowContext),\n            _ => throw new NotSupportedException($\"The syntax {Syntax} isn't supported for SetOutputTask.\")\n        };\n\n        workflowContext.Output[OutputName] = value;\n\n        return Outcome(\"Done\");\n    }\n}\n","sourceCodeStart":43,"sourceCodeEnd":69,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore.Modules/OrchardCore.Workflows/Activities/SetOutputTask.cs#L43-L69","documentation":"SetOutputTask computes the value to write into workflowContext.Output by switching on the activity's Syntax. Only Liquid (LiquidValue) and JavaScript (Value) evaluation are implemented; any other WorkflowScriptSyntax value reaches the default arm and throws NotSupportedException, so the output is never set.","triggerScenarios":"Executing a SetOutputTask whose Syntax property is not WorkflowScriptSyntax.Liquid or WorkflowScriptSyntax.JavaScript (default/unset enum value, unknown syntax deserialized from workflow JSON, or programmatic construction without Syntax).","commonSituations":"Imported workflow definitions from older environments with obsolete syntax values; a new WorkflowScriptSyntax enum member not yet supported by SetOutputTask; forgetting to assign Syntax when building the activity in code (commonly surfaced in unit tests that construct the task directly).","solutions":["Set Syntax to WorkflowScriptSyntax.Liquid and supply the value expression in the LiquidValue field.","Or set Syntax to WorkflowScriptSyntax.JavaScript and provide the value expression in the Value field.","Fix the stored workflow definition if it holds an invalid/legacy syntax value.","If a new syntax member was added to the enum, rebuild/update OrchardCore.Workflows so ExecuteAsync handles it."],"exampleFix":"// before\nvar task = new SetOutputTask(); // Syntax unset -> throws\n// after\nvar task = new SetOutputTask\n{\n    Syntax = WorkflowScriptSyntax.Liquid,\n    OutputName = \"Result\",\n    LiquidValue = new LiquidString { Expression = \"{{ Model.Value }}\" }\n};","handlingStrategy":"validation","validationCode":"// before executing the task\nif (setOutputTask.Syntax is not (WorkflowScriptSyntax.Liquid or WorkflowScriptSyntax.JavaScript))\n    throw new InvalidOperationException($\"SetOutputTask requires Liquid or JavaScript syntax; got {setOutputTask.Syntax}\");","typeGuard":"static bool IsSupportedSyntax(WorkflowScriptSyntax s) => s is WorkflowScriptSyntax.Liquid or WorkflowScriptSyntax.JavaScript;","tryCatchPattern":"try { result = await task.ExecuteAsync(workflowContext, activityContext); }\ncatch (NotSupportedException ex) { logger.LogError(ex, \"SetOutputTask evaluation failed for syntax {Syntax}\", syntax); /* mark output unset */ }","preventionTips":["Set Syntax explicitly when constructing SetOutputTask (also in tests)","Pair OutputName/Value/LiquidValue fields with the chosen syntax","Validate workflow JSON on import","Keep enum extensions and activity implementations in sync"],"tags":["workflows","unsupported-enum-value","script-syntax","orchardcore"],"backgroundTag":"unsupported-enum-value","analyzedSha":"4306c0717fe573f6fca1b4955909ddab6a192807","analyzedAt":"2026-09-13T17:41:05.024Z","contentChangedAt":"2026-09-13T17:41:05.024Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}