Assembly: OptimaJet.Workflow.Core

Class SubstitutionsProcessor

OptimaJet.Workflow.Core.CodeActions.SubstitutionsProcessor

Expands process parameter placeholders embedded in action, condition, and rule parameters, annotation values, and other text evaluated for a process instance.

public static class SubstitutionsProcessor

Methods

public static Task<(string newValue, bool wasSubstituted)> SubstituteAsync(string value, ProcessInstance processInstance) #
Replaces process parameter placeholders in value with values resolved through processInstance.

Parameters

Name
Type
Description
value
String
The text to inspect for parameter placeholders.
processInstance
ProcessInstance
The ProcessInstance that supplies parameter values for replacements.

Returns

Type
Description
Task<String, Boolean>
A tuple containing the transformed text and true when at least one placeholder was matched; otherwise, the original text and false.

Exceptions

Type
Description
Exception
Thrown when a parameter resolves to null and its placeholder specifies a nonempty format other than json.
RegexMatchTimeoutException
Thrown when placeholder matching exceeds the one-second regular-expression timeout.

Remarks

Placeholders use the @ParameterName or @(ParameterName) form recognized by RegexPattern.ParameterAndMaybeQuotes. Parentheses can delimit a placeholder from adjacent text and allow spaces in parameter names. Dotted names resolve values within structured parameters.

A nonempty format after : is passed to the value's ToString(string) overload. The special json format serializes the value with ParametersSerializer. Matching single or double quotes immediately around the entire placeholder are consumed as part of the match: ordinary replacements are emitted in double quotes, while a json replacement is inserted as a serialized JSON value.

Example

Order @Order.Id was created on @(CreatedAt:yyyy-MM-dd) substitutes a nested parameter value and a formatted date. @(Payload:json) inserts the serialized parameter value.