You can enable users to select individual items in a result matrix dashboard portlet and run an action (trigger an event) on a button click.
In this example, we have a Dashboard with a result matrix portlet listing LPG items. Users can select any of these items and run their recalculation.
Under the hood, there are two logics associated with this Dashboard. One logic (main) builds the Dashboard content. An Option Input allows the user to select one of the Live Price Grids that exist in the partition. When the Dashboard is refreshed, a result matrix displays the LPG Items, one row per item, with SKU and lastUpdateDate.
The user can select one or multiple rows, and click on the “Calc PGI” button. When the user clicks the button, we run a different logic (action), which reads the list of the selected SKUs (i.e. the LPG Items) and triggers the calculation of each of them.
After about one minute, to allow time for the backend processing, if you refresh the dashboard, you’ll see that the lastUpdateDate of the selected rows have changes, proving that the calculation has been done.
The “action” logic can do anything we allow in the Groovy Sandbox. Here we just recalculate the LPG items. But it could as easily create a new Live Price Grid or Price List with the selected SKUs.
The Dashboard logic contains the following elements:
The action logic contains the following elements: