Add and configure activities

In this step, you add the following nodes to the business rule as shown in the sample screen.

  • Get MOT History (RESTful service activity)

  • Test Report Loop (Loop activity)

  • Entry Found? (Decision)

  • Pass or Fail? (Decision)

  • End (End node)

  • Update Pass Counter (Expression activity)

  • Update Fail Counter (Expression activity)

  1. On the Start node, add an activity.
  2. Select Other > RESTful service as the Type.
  3. Enter GetMOTHistory as the Name.
  4. Select DVLA Search as the Web service.
  5. In the URL parameters editor, enter: MotHistory?apikey=DvlaSearchDemoAccount&licencePlate=.
  6. Then, right-click and select the License_Plate variable.
  7. Select GET as the Verb.
  8. Select JSON as the Type.
  9. Select Variable as the Response type.
  10. Select the MOT History process variable as the Value.
  11. Select Suspend job on error.
    Restful service activity get mot history
  12. On the Get MOT History activity, add an activity.
  13. Select Loop as the Type.
  14. Enter Test Report Loop as the Name.
  15. Configure the activity as shown below.

    Every time the loop activity is executed, it looks at the list of motTestReports and pulls the details for the currentIndex out into the TestReport Data object variable. You can then access the data for the report and make decisions.

  16. On the Test Report Loop activity, add a decision.
  17. Enter Entry Found? as the Name.
  18. Right-click the rule editor and select EntryFound process variable.
  19. On the Entry found decision, add a decision and an End node.
  20. Rename the decision to Pass or Fail?.
  21. Click the Entry found decision and set the True path to Pass or fail?.
  22. Click the Pass or fail? decision and add two activities.
  23. Rename the first activity to Update Pass Counter.
  24. Rename the second activity to Update Fail Counter.
  25. Select the Pass or fail? decision.
  26. In the rule editor, set the Condition text as: TestReport.testResult = "PASS".
  27. Set the True path to Update Pass Counter.
  28. Select the Update Pass Counter activity and select the arrow that appears, and then drag the arrow to connect to the Test Report Loop activity.
  29. Repeat the preceding step with the Update Fail Counter activity.
  30. Select the Update Pass Counter activity.
  31. Select Expression as Type.
  32. Under Configuration, click to add a new row to the table.

    The Expression dialog box appears.

  33. Select PassCount process variable as the Target variable.
  34. Right-click the editor and enter the Expression as: PassCount +1.
  35. Click Add.
  36. Select the Update Fail Counter activity.
  37. Select Expression as the Type.
  38. Under Configuration, click to add a new row to the table.

    The Expression dialog box appears.

  39. Select FailCount process variable as the Target variable.
  40. Right-click the editor and enter the Expression as: FailCount +1 .
  41. Click Add.

    The completed business rule looks similar to the following example.

  42. Release your business rule.

Next, return to the form design and add a button that calls the business rule. Continue to Update your form.