Step 5: Register Triggers

In this step, you will review how an Oracle Content Management trigger can been registered, which you can select using the Trigger Actions option under the Link tab in the Settings panel for your component.

Triggers are part of Oracle Content Management intercomponent communication. Any component can raise any number of triggers. The component can provide a payload for a trigger, which is then passed to any action that is executed when the trigger is raised. Users can select what actions should be executed for each trigger. Finally, components that are built to work together can automatically raise triggers to execute actions on the other component without the user needing to define the interaction between the components.

For components you add, triggers are registered as part of the registration data for the component. To add a trigger, update the "triggers" property array with each trigger the component supports. You also must specify the payload the trigger supports so that the user interface can be created to allow the user to map values within the payload to properties supported by the action.

Open the appinfo.json file and review the "triggers":[], entry.

"triggers": [{
    "triggerName": "imageClicked",
    "triggerDescription": "Image clicked",
    "triggerPayload": [{
      "name": "payloadData",
      "displayName": "Trigger Payload Data"
   }]
}],

In this entry, you’ll see the following:

  • A triggerName, "imageClicked", which should be a unique value, and will be typically namespaced by your custom component ID.

  • A triggerDescription, "Image clicked", which is used by the user interface dialog to display your trigger.

  • A single value triggerPayload, "payloadData", for your trigger. Users will be able to select entries in this payload and map them to fields in the action.

Check the Results for Step 5

You can see and select your trigger when you go to the Link tab in the Settings panel for your component:

  1. Refresh your page in your site so Site Builder can pick up changes to the component.

  2. Take the page into Edit mode.

  3. Drag and drop your component onto the page.

  4. Bring up the Settings panel against your component.

  5. Select the Link tab at the top of the Settings panel.

  6. Click Trigger Actions as the Link Type.

  7. Click the Image clicked trigger that you registered.

  8. In the dialog, drag the Show Alert action from within the Page Actions section. (Page Actions are built-in actions supplied by Oracle Content Management.)

  9. In the Message field, select the Trigger Payload Data value, which is the name of the entry in the payload you saw when you registered the trigger. You can change this to any name you want.

Now you’re able to register a trigger and map the trigger to a built-in action, passing through a value. In the next step we’ll review how the trigger is raised to execute the action.

Continue to Step 6: Raise Triggers.