When I have an automation script that launches another sub automation script, can I pass/return data from my sub script to my 'parent' script? E.g. in case there's an exception in the subscript.
Hi Jochen, when running an automation script as subscript you can return data to the main script via the AddScriptOutput.
Here an example of how I use it:
Subscript:
// Add data to be returned to main script.
engine.AddScriptOutput("PlmStorageJson", storageJson);
engine.AddScriptOutput("PlmError", error);
Mainscript:
var scriptOptions = _engine.PrepareSubScript("SLC_DOM Get Storage Data");
...
scriptOptions.StartScript();
Dictionary<string, string> result = scriptOptions.GetScriptResult();
string plmError = string.Empty;
string plmStorageJson = string.Empty;
result.TryGetValue("PlmError", out plmError);
result.TryGetValue("PlmStorageJson", out plmStorageJson);
A video explaining this is also available in the Automation course: https://community.dataminer.services/lessons/subscript-results/
Exactly what I needed, thanks!