{"record":{"id":"39f91fc9bb1ec266","repo":"OrchardCMS/OrchardCore","slug":"the-syntax-syntax-isn-t-supported-for-setpropertytask","errorCode":null,"errorMessage":"The syntax {Syntax} isn't supported for SetPropertyTask.","messagePattern":"The syntax (.+?) isn't supported for SetPropertyTask\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/OrchardCore.Modules/OrchardCore.Workflows/Activities/SetPropertyTask.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 SetPropertyTask.\")\n        };\n\n        workflowContext.Properties[PropertyName] = 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/SetPropertyTask.cs#L43-L69","documentation":"SetPropertyTask computes the value to write into workflowContext.Properties by switching on the activity's Syntax. Only Liquid (LiquidValue) and JavaScript (Value) evaluation are implemented; any other WorkflowScriptSyntax value falls to the default arm and throws NotSupportedException, so the workflow property is never set.","triggerScenarios":"Executing a SetPropertyTask whose Syntax property is not WorkflowScriptSyntax.Liquid or WorkflowScriptSyntax.JavaScript — an unset/default enum value, an unrecognized syntax string deserialized from workflow JSON, or programmatic creation without assigning Syntax.","commonSituations":"Workflow definitions imported from other environments carrying stale syntax names; a newly added WorkflowScriptSyntax member unsupported by SetPropertyTask; missing Syntax assignment when constructing the activity in code or tests.","solutions":["Set Syntax to WorkflowScriptSyntax.Liquid and supply the value in the LiquidValue expression field.","Or set Syntax to WorkflowScriptSyntax.JavaScript and provide the value in the Value field.","Correct the stored workflow definition if it contains an obsolete syntax value.","If a new syntax member exists in the enum, update/rebuild OrchardCore.Workflows so the switch arm is implemented."],"exampleFix":"// before\nvar task = new SetPropertyTask(); // Syntax unset -> throws\n// after\nvar task = new SetPropertyTask\n{\n    Syntax = WorkflowScriptSyntax.JavaScript,\n    PropertyName = \"LastRun\",\n    Value = new JavaScriptExpression { Expression = \"new Date().toISOString()\" }\n};","handlingStrategy":"validation","validationCode":"// before executing the task\nif (setPropertyTask.Syntax is not (WorkflowScriptSyntax.Liquid or WorkflowScriptSyntax.JavaScript))\n    throw new InvalidOperationException($\"SetPropertyTask requires Liquid or JavaScript syntax; got {setPropertyTask.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, \"SetPropertyTask evaluation failed for syntax {Syntax}\", syntax); /* mark property unset */ }","preventionTips":["Set Syntax explicitly when constructing SetPropertyTask","Pair PropertyName/Value/LiquidValue fields with the chosen syntax","Validate imported workflow definitions","Cover all WorkflowScriptSyntax members when extending the enum"],"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"}