Error Message :
Publish does not work unless the Object variable is created or defined before the function is called.
The product documentation states:
The script statement :PUBLISH converts a script variable or a script array to an object variable and, if required, it passes it on to the superordinate task.
If you define the parameter Object Variable, the system *creates a new object variable* with this name and the value of the script variable. An existing object variable of the same name will be overwritten and the script variable remains unchanged in this case.
Root Cause: According to the documentation this is the correct behavior:
This script statement is similar to the script element :PSET. The difference is that the specified scripting variable must exist and that you can also use arrays.
and the sentence:
If you define the parameter Object Variable, the system creates a new object variable with this name and the value of the script variable.
is a bit misleading
OS Version: N/A
Update to a fix version listed below or a newer version if available.
Fix Status: In Progress
Automation Engine 12.2.0 - Planned release date: 2018-06-19
Automation Engine 12.1.1 - Available
This causes the error: