Overview
The Action Builder in Learnosity allows you to automate specific behaviors within an Item by linking events (triggers) with actions (responses).
This article explains the mapping matrix, which acts as a reference for valid combinations of:
- Event origin and Event name
- Action target and Action name
This article only covers the mapping rules for the different events and actions that can be set as part of the workflow array attribute in Items. To programmatically set these rules for Items in your Item Bank, refer to the Set Items Data API endpoint documentation. The format for defining events and actions follows the structure <type>:<reference>:<event/action>. For example, an action to enable a specific Widget would be written as "action": "widget:a44fef61-dc37-4f04-a737-95250b379fa6:enable".
For definitions and functionality of each Event name and Action name option, refer to the Understanding the Action Builder.
Note: This article only covers the mapping rules. For detailed instructions on how to implement these rules programmatically, refer to the Data API documentation, where these mappings are used as valid permutations within the workflow parameter.
Key concepts
| Term | Description |
|---|---|
| Event origin | The source where the trigger occurs, such as the current Item, a specific Widget, or a simple Feature within a Widget (e.g., Audioplayer). It acts as a reference that identifies where the event is coming from. |
| Event name | The specific type of event triggered by the Event origin (e.g., Item loaded, Playback started). |
| Action target | The destination or scope where the action will be applied. This is also a reference for Items, Widgets, or simple Features within Widgets, indicating exactly where the action should take place. |
| Action name | The response to be executed when the event is triggered (e.g., Enable, Pause recording). |
1. Event origin and Event name mapping
This table defines valid event origins and their associated event names. These define what triggers an automation rule.
Note: For the purpose of this table, both simple Features and standalone Features are treated simply as Features. This means that where a possible event name is available for each selected Widget type, it applies equally to both simple Features and standalone Features. For more details on simple and standalone features, see What are Features and Simple Features.
| Event origin | Event name (value / text) |
|---|---|
| Item |
onLoad / Item loaded |
| Any Widget |
change / Widget changed |
| Audioplayer Feature |
complete / Widget completed |
| Audio Question type |
recording:started / Recording started |
| Audio Question type |
recording:paused / Recording paused |
| Audio Question type |
recording:resumed / Recording resumed |
| Audio Question type |
recording:stopped / Recording stopped |
| Audio Question type, or Audioplayer, or Videoplayer Feature |
playback:started / Playback started |
| Audio Question type, or Audioplayer, or Videoplayer Feature |
playback:paused / Playback paused |
| Audio Question type, or Audioplayer, or Videoplayer Feature |
playback:resumed / Playback resumed |
| Audio Question type, or Audioplayer, or Videoplayer Feature |
playback:complete / Playback completed |
| Audio Question type, or Audioplayer, or Videoplayer Feature |
playback:stopped / Playback stopped |
2. Action target and Action name mapping
This table defines where actions are applied and the types of actions available. These determine what happens when an event is triggered.
Note: For the purpose of this table, both simple Features and standalone Features are treated simply as Features. This means that where a possible action name is available for each selected Widget type, it applies equally to both simple Features and standalone Features. For more details on simple and standalone features, see What are Features and Simple Features.
| Action target | Action name (value / text) |
|---|---|
| Item |
pause / Pause |
| Item |
resume / Resume |
| Item |
next / Go to next Item |
| Item |
navigation:enable / Enable navigation |
| Item |
navigation:disable / Disable navigation |
| Item |
widgets:disable / Disable all widgets |
| Item |
widgets:enable / Enable all widgets |
| Any Question type, or Audioplayer, Calculator, Videoplayer, or Imagetool Feature |
enable / Enable |
| Any Question type, or Audioplayer, Calculator, Videoplayer, or Imagetool Feature |
disable / Disable |
| Audio Question type, or Audioplayer, or Videoplayer Feature |
begin / Begin |
| Audio Question type |
recording.start / Start recording |
| Audio Question type |
recording.pause / Pause recording |
| Audio Question type |
recording.resume / Resume recording |
| Audio Question type |
recording.stop / Stop recording |
| Audio Question type |
response.play / Play response |
| Audio Question type |
response.pause / Pause response |
| Audio Question type |
response.resume / Resume response |
| Audio Question type |
response.seek / Seek response |
| Audio Question type |
response.stop / Stop response |
| Audioplayer Feature |
audio.play / Play |
| Audioplayer Feature |
audio.pause / Pause |
| Audioplayer Feature |
audio.resume / Resume |
| Audioplayer Feature |
audio.seek / Seek |
| Audioplayer Feature |
audio.stop / Stop |
| Videoplayer Feature |
video.play / Play |
| Videoplayer Feature |
video.pause / Pause |
| Videoplayer Feature |
video.resume / Resume |
| Videoplayer Feature |
video.seek / Seek |
| Videoplayer Feature |
video.stop / Stop |
How to use these tables
-
Start with the event: Choose a valid Event origin and Event name from the first table.
Example: Event origin → Audioplayer Feature, Event name →playback:complete. -
Select the action: Choose a valid Action target and Action name from the second table.
Example: Action target → Item, Action name →widgets:enable. -
Combine them: Create a rule that links the event and the action.
Example: “When playback completes in the audio player, enable all Widgets in the Item.”
Workflow example JSON for Data API
The workflow parameter is an array of objects, where each array entry defines a single automation rule in the format:
When <event> happens, execute <action>.
"workflow": [
{
// Rule 1: When the item loads, enable a specific Widget.
"event": "item:onLoad",
"action": "widget:0e763ae6-0e1d-4a27-9090-176903703b54:enable"
},
{
// Rule 2: When playback starts on the first Widget, enable another Widget.
"event": "widget:0e763ae6-0e1d-4a27-9090-176903703b54:playback:started",
"action": "widget:57a57e3a-2c99-4444-a7a0-233eafaefa30:enable"
},
{
// Rule 3: When a specific Widget changes, trigger video playback on another Widget.
"event": "widget:459b9a98-6e3e-46cd-9eb9-a3f72bed6d9e:change",
"action": "widget:50eb8f0e-e8f4-46f8-843b-27d2bf620938:video.play"
},
{
// Rule 4: When the video Widget changes, resume the item.
"event": "widget:50eb8f0e-e8f4-46f8-843b-27d2bf620938:change",
"action": "item:resume"
}
]
Explanation
- Workflow as an array: The entire workflow is a JSON array (
[...]). Each element in the array represents one rule consisting of an event and an action. - Event format:
-
item:onLoad→ The event comes from the Item itself when it loads. -
widget:<UUID>:change→ The event is triggered when a specific Widget changes, where<UUID>is the Widget's unique identifier.
-
- Action format:
-
widget:<UUID>:enable→ The action targets a specific Widget to enable it. -
widget:<UUID>:video.play→ The action triggers a video play operation on a specific Widget. -
item:resume→ The action applies to the entire Item.
-