Condition Scripts
A condition script can be used by the commands that use a condition to determine a particular outcome, such as commands that control execution flow. The Condition script is also used in Branch, Retry & Exit.
The following script is an example of a condition script:
The following Example uses the Branch Command and the condition scripts are written in the transformation option.
Python
from se_scripting_utils import *
def transform_content(content: str, context: RunContext):
if len(content) == 10:
return "Branch"
else:
return ""
C#
public string TransformContent(string content, RunContext context)
{
if (content.Length == 10)
{
return "Branch";
}
else
{
return "";
}
return content;
}
The above example uses the Branch command and returns the name of the Branch command which is “Branch”. As per the requirement, the condition can either allow us to enter the Branch command or disallow Agent flow to enter the Branch and return “” blank.
Regex
if empty return "Branch" else return ""
The above command checks whether the extracted content is empty or not. If empty, it will allow the “Agent” to enter the “Branch” command but if not, it will not allow the Agent to enter the Branch command.