Table of Contents

Making DOM objects state-aware

This tutorial shows how you can make your DOM objects state-aware. This allows a DOM instance to behave differently depending on the state it transitions to. The following things can be defined for each state:

  • Which fields are visible to the user.
  • Which fields are read-only for the user.
  • Which fields are mandatory.
  • To which state the instance can transition.
  • What actions are allowed.
  • What buttons to show on the form.

The content and screenshots for this tutorial were created in DataMiner version 10.4.3.

Expected duration: 20 minutes

Tip

This tutorial is included in the following Kata: Kata #24: Making DOM objects state-aware on DataMiner Dojo Video

If you are new to DataMiner Object Models (DOM), first watch Kata #15: Getting started with DataMiner Object Models on DataMiner Dojo Video

Prerequisites

Note

If you use a DaaS system, these prerequisites are automatically met.

Overview

Step 1: Deploy the DOM Editor script

Note

If you have already followed the previous tutorial, Getting started with DOM, this script has already been deployed, so you can skip to step 2.

  1. Go to https://catalog.dataminer.services/details/automation-script/3195.

  2. Click the Deploy button to deploy the DOM Editor package to your DMA.

  3. Open DataMiner Cube, go to Apps > Automation, and check whether the following scripts have become available:

    Dom Editor scripts

    When these are available, the package has been successfully deployed.

Step 2: Deploy the Kata DOM package

  1. Go to https://catalog.dataminer.services/details/package/5995.

  2. Click the Deploy button to deploy the Kata DOM package to your DMA.

  3. Go to the DataMiner landing page and check whether the Event Management low-code app has become available.

    If this app is available, the package has been successfully deployed.

Step 3: Define states on a DOM definition

Now that you have deployed the DOM Editor to your DMA, you can use it to edit the existing DOM definition called Event:

  1. In the Automation module in DataMiner Cube, search for the Dom Editor script and select it.

  2. Click the Execute button in the lower right corner to launch this script, and then click Execute now.

    Dom Editor script

    The following window will be shown, where you should find a module called eventmanagement:

    Dom Editor modules

  3. Next to the eventmanagement module name, click Edit to open the details of the module.

  4. Create a new behavior definition:

    1. Click Behavior Definitions to go to the behavior definitions overview for this module.

      Dom Editor behavior definitions

      This overview is where you can manage everything related to states of a DOM definition.

    2. Click New.

      Dom Editor new behavior definition

    3. In the Name box, enter event behavior.

      Dom Editor new event behavior definition

    4. Confirm by clicking Apply.

  5. Define states for the Event DOM definition:

    1. Click Statuses.

      Dom Editor statuses

    2. Click New to create a new state.

      Dom Editor new status

    3. In the Display Name box, enter Request.

      Dom Editor new status name

    4. Click Back and repeat the previous two steps to create the states Scheduled, In progress, and Done.

    5. Finally, click Back again to go the event behavior page, and click Apply.

      Dom Editor apply behavior

  6. Click Statuses to go to the overview of the created states.

  7. Define which sections and fields should be linked to the states you have defined:

    1. Next to the Request state, click Edit.

      Dom Editor edit request state

    2. Click Section Definition Links.

      Dom Editor section definition links

    3. Click Add.

      Dom Editor add section definition link

      This will show a page where you can define the sections and fields linked to the state Request. The Event Info section will automatically be linked already.

    4. Click Field Descriptors to define a field to add to the Event Info section.

      Dom Editor add section link

    5. Click the + button 4 times to add the 4 fields of the section to the Request state.

      Dom Editor state add field

      You should end up with the following 4 fields added:

      Dom Editor state all fields

    6. For the Notes field, clear the selection from the Visible checkbox.

      Dom Editor hide Notes field

      This way, the Notes field will not be shown for the Request state.

    7. Click Back three times to go back to the overview of the different states.

    8. Repeat the steps above for the states Scheduled, In progress, and Done.

      • For the Scheduled state, set all fields to read-only.

      • For the remaining states, you can choose which fields to display, make required, or set to read-only.

    9. When this is done for all states, click Back until you are back at the event behavior page.

    10. Click Apply.

  8. Click OK and Back to go back to the eventmanagement module page.

  9. Click Definitions.

    Dom Editor definitions

  10. Next to the Event definition name, click Edit to open the details of the DOM definition.

  11. In the Behavior dropdown box, select the behavior you created above, i.e. event behavior.

  12. Click Apply, OK, and Back to go back to module level.

Step 4: Define the state transitions

  1. Click Behavior Definitions.

  2. Next to event behavior, click Edit .

  3. Click Transitions to open the page where you can define the transitions between the different states.

    Dom Editor transitions

  4. Define the following transitions:

    ID From To
    request_to_scheduled Request Scheduled
    scheduled_to_in progress Scheduled In progress
    in progress_to_done In progress Done

    Dom Editor 3 transitions

  5. Click Back and Apply.

Step 5: Define actions to trigger state transitions

  1. Click Actions to open the page where you can add actions.

    Dom Editor actions

  2. Click Add to add a new action.

  3. Enter the following details for the action:

    1. In the ID box, enter schedule.

    2. In the Script box, enter Event Button.

      This is the Automation script that will be called when this action is triggered.

    Dom Editor add action

  4. Click Back, Back, and Apply.

Step 6: Define a form button to trigger the action

  1. Click Buttons to open the page where you can add buttons.

    Dom Editor buttons

  2. Click Add to add a new button.

  3. Configure the following details for the button:

    1. In the ID box, enter schedule.

    2. In the Text box, enter Schedule.

    3. Under Actions, click the + button, and select schedule in the dropdown box.

      This is the action you created in step 5.

    4. Under Condition > Type, select Status.

    5. Under Valid Statuses, click Add, and then select Request in the dropdown box.

      With this configuration, the button will only be shown on the form when the event instance is in the Request state. It will not be visible for the other states (Scheduled, In progress, and Done).

    Dom Editor add button

  4. Click Back, Back, and Apply.

Step 7: Validate states, transitions, and buttons in the low-code app

  1. Open the Event Management low-code app.

    Empty Event Management app

  2. Click New to open the event form panel on the right-hand side.

  3. In the Event name field, enter a random name for an event.

    App form

  4. Click Save.

    This will close the panel.

  5. Click the pencil icon next to the event you have just created to open the panel again.

    You will see that the stepper component at the top shows that the event is in the Request state:

    App stepper in Request state

  6. In the lower right corner of the form, click the Schedule button.

    App Schedule button

    You will see the stepper component move from Request to Scheduled. The form will also change to read-only, as you configured this when defining the states.

    App stepper event in Schedule state