I'm trying to use custom entrypoints in an Automation script but can't figure out how exactly to use this.
When I add the following C# code in my script, the script can't compile because of syntax errors:
However, when I add an additional Script class (even commented out), the script seems to compile:
The problem is that I can then still not execute my script correctly. The script can only be executed if I add a Script class with a Run method, but then this Run method is used as entrypoint.
Am I doing something wrong or could this feature currently be broken (I have been testing using 10.0.9.0-9365)?
I also noticed that there is not only a "Default" AutomationEntryPointType, but that you can also add an additional "AutomationEntryPointTest" entry point. How does DataMiner determine which one to trigger in case both are defined in your script?
Hi Joey,
Compilation errors issue:
There is some logic in the Automation module that makes it possible to define script code without having to put this in a Run method of the Script class. (You can just type "engine.GenerateInformation("It works");" in the code field, and this will generate the information event.) This only works for script code that can be executed in a single method. When you want to define your own class and use custom entry points, you will have to define the 'Script' class somewhere in the script. The last point in 'Restriction' on the Automation entry points help page also advises to always define this. It also states that it 'is no longer strictly required', but I think this should be revised.
Entry point issue:
When you want to execute a script with an entry point, you need to define the entry point in the CustomEntryPoint field of an ExecuteScriptMessage.
This is empty for scripts that are executed with the execute button in Cube.
In regards to your last question. DataMiner will thus execute the entry point that was defined in the execute message. A script can have multiple (unique!) entry points.
Automation scripts with custom entry points cannot be started using the Cube interface.
In order to start an automation script from a custom entry point you need to send the "ExecuteScriptMessage" (Fill in CustomEntryPoint) to SLNet. This is where you select the entrypoint for the script.
You will need to specify either:
- An empty Script class, containing no methods/properties whatsoever
- Define the different entrypoints in the Script class.
This is because the code will automatically wrap your entire C# block in a Script class if none is present. This is to accomodate small automation scripts that do not specify classes or methods.
The different entry points defined at the moment are tailored for specific use cases and are only called by the server itself (for SRM for example).
Thanks! This answers all my questions 🙂
I’ll follow up with Documentation to update this information so it’s clear in the future.