Configure the rraProducts Action Chain for KPI 2

  1. Navigate to Action Chains.
    1. On the orders-analysis tab, click the Actions tab.
    2. Click Action Chains.
      The orders-analysis, Actions tab displays with Action Chains outlined in red.
  2. Click load_KPI_2_data.
    On the Actions window, load_KP_2_data is outlined in red.
    The Diagram tab opens.
    The Diagram tab window displays with the Start point.
  3. In the Actions pane under General, click Call REST and drag it under the Start point and over the + icon, then drop it.
    In the Actions palette under General, Call REST is outlined in red. On the canvas, Call REST is directly under the start and the Fire notification error, under the failure path, is outlined in red.

    With this configuration method, the failure path for the REST call is automatically handled for you.

  4. Configure the call REST action.
    1. In the Properties pane, click Select.
      The Call REST properties pane displays with Select outlined in red.
    2. In the Select Endpoint dialog box, expand Services > fscmRest > rraProducts.
    3. Select GET /rraProducts.
      The Select Endpoint window displays, with Services, fscmRest, and rraProducts expanded and GET /rraProducts displaying, outlined in red.
    4. Click Select.

      In the Properties pane, the ID value automatically updates to reflect the selected endpoint.

  5. To replace the Call REST action name with a more descriptive title, in the Label field, enter Fetch All Stock Items.
    The Call REST properties pane displays with Fetch All Stock Items in the Label field, outlined in red, and the label displaying on the canvas under Start, outlined in red.
  6. Replace the default get limit, which is in increments of 25, with a more reasonable limit for the KPI.
    1. Under Input Parameters, click # limit.
    2. In the Assign Input Parameters dialog box, in the Target panel, select # limit.
    3. In the # uriParams.limit field at the bottom of the dialog box, enter 1000.
    4. Select the Static Content option if it isn't already selected.
      The Assign Input Parameters window displays with the # uriParams.limit field and the Static Content option outlined in red.
    5. Click Save.
  7. Configure the success path with the Assign Variables action.
    1. In the Actions palette, click Assign Variables and drag it under the success path and over the Return action, then drop it.

      The Assign Variables action has an error icon and in the Properties pane, the error tells you that you need more than one property because you haven't configured any properties yet.

    2. To replace the Assign Variables action name with a more descriptive title, in the Label field, enter Assign Total Items in Stock.
      The Actions pane displays with Assign Variables outlined in red, and the Properties pane, Label field is outlined in red with Assign Total Number of Stock entered.
    3. Next to Variables, click Assign.
    4. On the Sources side of the Assign Variables dialog box, expand Action Chain > Results > { } callRestGetallRraProducts > { } body.
    5. In the Target panel, under Page, expand [ ] kpisArray, and select { } item[i].
    6. In the text area at the bottom of the dialog box, under { } $page.variables.kpisArray[0] field, select the Expression option.
    7. In the Sources panel, click # count and drag it over the Target panel { } item[i] variable.
      The relevant expression should appear in the text area at the bottom of the dialog box in the { } $page.variables.kpisArray[0] field. If it doesn't, copy this expression and paste it in the field: $chain.results.callRestGetallRraProducts.body.count.
      The Assign Variables window displays with the { } $page.variables.kpisArray[0] field and the Expression option outlined in red.
    8. Click Save.
  8. By default, the variable assignment applies to the entire array. Update it to apply to only the metric of KPI 2.
    1. On the Diagram subtab, click Code.
    2. In the assignVariablesKpisArray section, under parameters, change $page.variables.kpisArray to $page.variables.kpisArray[1].metric.
      The Actions tab displays with Code and $page.variables.kpisArray[1].metric in the assignVariablesKpisArray section outlined in red.
  9. To test the action chain, go to the Page Designer subtab and click Live if you're not already in the Live mode.
    Under Total Items in Stock, the --- should be replaced with the number of items. It takes some time for the information to appear. You might need to refresh the page to get the information to appear.
    The Page Designer tab displays with the Total Items in Stock section outlined in red.