Step 7: Register Actions

Oracle Content Management actions are called on components when triggers are raised.

A component can register any number of actions and also define the payload the action supports. When a user selects an action, they can populate the payload to be passed to the action.

As with registering triggers, you can register actions that your component supports in the appinfo.json file registration data. To review the registration of the sample action in your component, open the appinfo.json file and find the "actions" code.

"actions": [{
  "actionName": "setImageWidth",
  "actionDescription": "Update the image width",
  "actionPayload": [{
    "name": "imageWidth",
    "description": "Image Width in pixels",
    "type": {
      "ojComponent": {
        "component": "ojInputText"
      }
    },
    "value": ""
  }]
}]

This registered action will be visible in the Action dialog that’s invoked when you click a trigger in the Link tab in the Settings panel for the component.

Check the Results for Step 7

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

  2. Take the page into Edit mode.

  3. Drag and drop your component onto the page.

  4. Drop a Button component onto the page.

  5. Bring up the Settings panel against the Button component.

  6. On the General tab, change the label of the button to Click me!.

  7. Select the Link tab on the Settings panel.

  8. Select Trigger Actions as the Link Type.

  9. Click the Click on Button trigger against the Button component.

  10. In the dialog, expand the A_Local_Component component in the left side palette.

  11. Drag and drop the Update the image width action from the A_Local_Component component onto the page.

  12. Enter 300px in the Image width in pixels field.

You've now seen how you can register an action and how that action will show up in the user interface. In the next step you will learn how to handle an action within your component when it is called.

Continue to Step 8: Execute Actions.