Table of Contents

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 Video

Step 1: Create an information event script

  1. Open DataMiner Cube and go to the Automation module.

  2. Create a new folder with the name "Utility".

  3. Within this folder, add a new Automation script with the name "Generate Information Event".

  4. Add a script parameter named "Message".

    This parameter will contain the message that needs to be mentioned in an information event.

  5. Add a C# action containing the following code:

    engine.GenerateInformation(engine.GetScriptParam("Message")?.Value ?? "No message.");
    

    Your script should look like this:

    Generate information event script

  6. Check whether the script runs correctly:

    1. Click the Execute button.

    2. Provide a message to display in an information event.

    3. Check the information events for the message.

Step 2: Use the 'on page load' event

  1. Make sure you are editing the app.

  2. On the page for which you want to generate an information event, go to the Events section and expand it.

  3. Click the "Configure actions" icon to display the action editor.

    On page load event

  4. Configure the action to run the Automation script:

    1. Select the action Launch a script.

    2. Select the script Generate information event.

    3. Expand the Parameters section and fill in "IPAM - IPs visited".

    4. Click Ok.

    Launch a script action
    DataMiner Low-Code Apps in DataMiner 10.3.12

  5. Publish the app.

  6. 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: