How To - Resolving Workflow Diagram Loading Error (Stream Write Error)

Issue:
An error occurs when attempting to load a workflow diagram if a script block saves a VarArray. This typically happens when square brackets ([ ]) are used incorrectly in the script.
Explanation:
Using square brackets ([ ]) in a script tells the compiler to create a VarArray. However, variables of type VarArray cannot be saved to the .dfm file, causing the workflow loading process to fail.
Guidelines:
Avoid using square brackets when assigning a value to a variable in script blocks (and transition scripts). Assign values directly without brackets to prevent errors.
Incorrect Example:
begin
DisplayText := [TaskMessage]; // This creates a VarArray and causes an error
end;
Correct Example:
begin
DisplayText := TaskMessage; // This assigns the value directly and works correctly
end;
Recommendation:
When writing or debugging scripts for workflows:
- Check for square brackets in variable assignments.
- Replace any usage of square brackets ([ ]) with direct assignments.
Test the script to ensure the workflow diagram loads successfully.