Note: For detailed information about extension architecture, extension points that can be overridden, and recommendations for extension programming, refer to Using Application Extensions.
Note that for this extension to behave as expected, the Interaction that you run needs to contain a collection display. The page shown above (Your New Order) is taken from the Sample Call Intent Interaction, which is one of the sample Interactions provided to get you started.
To create an application extension:
- From the Resources menu of the Admin Console, select Extensions.
The Extensions page opens. Any previously added extensions are listed in the grid. For example:
- At the upper right corner of the Extensions page, click Add.
The New Extension page opens. In the code editor, there are placeholders for the following items that are used by every application extension:
- initExtensions function: This function initializes the extension, so it can be used by an application. When the extensions file is loaded, it will be called with a callback function passing the app argument, which is the handle to the application. Through the app argument you can access everything in the running client.
- registerExtension method: This method registers the extension point. The method is called with the name of the extension point and a callback function. This causes the callback to be called when the framework is about to create the DOM element for the relevant page element.
Note: For more information and code examples about registering extensions and extension points , refer to Creating Application Extensions.
- In the Name field at the top of the page, enter a relevant name for your extension. (This field is mandatory.) Then, in the Description field, enter notes or comments about the extension.
- If desired, in line 1 of the code editor, replace the word sample with the name of your extension. (Although this action is not necessary, it is recommended so you can later easily locate the extension's code for debugging purposes. For more information, refer to Extensions: Tips and Best Practices.)
Then, since we are not registering the loaded event as part of this extension (we will register a specific renderer instead), remove the sample code relevant to the loaded event.
- To register the extension, replace the default pageRenderer with the name of the relevant extension point, and change the code so the extension receives the element as a parameter. Then, modify the sample code to return the element after it is extended.
- Now you are ready to write the extension code. First, the extension will check for the page title. If (and only if) the page title is Your New Order, the extension is run.
- Next, the extension loops through all the rows in the Collection Display.
- In each row, the extension performs the following sequence of actions:
- Takes the first cell of a row.
- Gets the cell text, and stores it in a variable.
- Empties the cell.
- Appends an image into the cleared cell. The source of the image is set from the cell's text, which was stored in a variable.
- To save the extension, at the upper right corner of the page, click Save.
A confirmation message is displayed, and the new extension is listed in a new row in the grid on the Extensions page. Your extension is now available for use in Agent, Mobile Web, and Web Self Service applications.
Activating Extensions in Applications
By default, all defined application extensions are available for use in all Jacada Interact clients. However, for an extension to actually affect the behavior of an application, the extension needs to be activated for use in that application. This is done by applying the extension to the application, from the application's Client Settings tab.
The following procedure explains how to apply your new extension to the Web Self Service application. (By default, a similar extension is already applied to the Mobile Web application.)
To apply an extension to the Web Self Service application:
- From the Extensions page, at the left side of the grid, select the checkbox of the imageUrl extension.
The Apply To list is enabled.
- To apply the extension, from the Apply To list, select Web Self Service.
The Client Settings tab of the relevant application opens in Edit mode. In the Extensions section at the bottom of the page, the imageUrl extension is listed in the Selected Extensions frame. (The extensions listed in this frame are the ones that are activated in the application.)
Note: For more information about the Extensions frame and editing the Selected Extensions list, refer to Working with Extensions in the Admin Console.
- At the upper right corner of the page, click Save.
A confirmation message is displayed, and the Applications page opens.
- To test your extension, run the Sample Call Intent Interaction in the Web Self Service application, and navigate to the Your New Order page.