Running a script when a page opens
This tutorial explains how you can run an Automation script every time a user opens a page.
Expected duration: 10 minutes
Overview
Tip
See also: Kata #8: Actions and events in a low-code app on DataMiner Dojo
Step 1: Create an information event script
Open DataMiner Cube and go to the Automation module.
Create a new folder with the name "Utility".
Within this folder, add a new Automation script with the name "Generate Information Event".
Add a script parameter named "Message".
This parameter will contain the message that needs to be mentioned in an information event.
Add a C# action containing the following code:
engine.GenerateInformation(engine.GetScriptParam("Message")?.Value ?? "No message.");
Your script should look like this:
Check whether the script runs correctly:
Click the Execute button.
Provide a message to display in an information event.
Check the information events for the message.
Step 2: Use the 'on page load' event
Make sure you are editing the app.
On the page for which you want to generate an information event, go to the Events section and expand it.
Click the "Configure actions" icon to display the action editor.
Configure the action to run the Automation script:
Select the action Launch a script.
Select the script Generate information event.
Expand the Parameters section and fill in "IPAM - IPs visited".
Click Ok.
DataMiner Low-Code Apps in DataMiner 10.3.12Publish the app.
Navigate to the page in the app and check if an information event is generated.
Next tutorial
You can also chain actions so they are executed one after another:
Learning paths
This tutorial is part of the following learning path: