Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Insert excerpt
_Banners
_Banners
nameactionflow
nopaneltrue

 Training Exercise

You have now learnt how to create and configure Actionflows that require sophisticated processing logic in PhixFlow. To reinforce the techniques you have learnt, complete these assignments. 

Don't worry, this is not an exam. You can use the Help to broaden your understanding and assimilate knowledge. A number of hints have been provided; use these if you are struggling as each hint gives you more information on the solution.  

Tip

A training instance is required to complete these assignments. Use the application: Actionflow Intermediate Application.

.

Expand
titleAssignment Hint

Remember to close and reopen your screen if you do not see the changes you expect.

Assignment 1

Difficulty Level: Hot

Task 1

  1. On the Government Organisations screen, create an Actionflow on the Run API button that retrieves the JSON data from this API: https://www.gov.uk/api/organisations, and record the results to the Output Attributes, as defined in the table below

    Excerpt


    Tip

    Ensure you open the above link to view the JSON. We recommend viewing the data in Google Chrome,  using the 'Pretty print' option, or in Notepad++, using the JSONTools plugin, or in Visual Studio Code using the extension 'Prettier'.



  2. Save the data to the table, Gov_Organisations
Attribute NameJSON Element
Nametitle
UIDcontent_id
ClassNameorganisation_brand_colour_class_name
Statusgovuk_status
URLweb_url


Expand
titleHint

The table, Gov_Organisations, can be found in the Repository for your application if you would like to add it to your ERD and take a closer look at its setup. This table backs the screen, Government Organisations.

.

Expand
titleSolution

Actionflow Setup

HTTP Action Setup

Mappings - HTTP to JSON

JSON Action Setup

Mappings - JSON to Save

Save Action Setup


Task 2

  1. Modify the Actionflow on the Run API button so that where the ClassName attribute receives the result, "ministry-of-justice", set the Justice boolean attribute to Y.
  2. Then converge both flows of data back together before completing the Save action.


Expand
titleHint

To ensure only records containing a ClassName of "ministry-of-justice" receive the Y attribute, use a Gateway action.


Expand
titleSolution

Actionflow Setup

This is just one example of how this can be achieved. Another way to achieve this is using an if statement on a Calculate action instead of using a Gateway and Converge.

Mappings - JSON to Gateway

Mappings - Gateway to Calculate

Calculate Action Setup


Mappings - Calculate to Converge

Mappings - Gateway to Converge

Converge Action Setup

Mappings - Converge to Save



Task 3

Modify the Actionflow on the Run API button to initiate a new phase after the Save action. In the new phase send an email to yourself stating that the API has been successfully called. Set the To field on the

Insert excerpt
_action_email
_action_email
nopaneltrue
 action to your own email so you can see it working.

Expand
titleHint

To trigger the next phase, the last action node in the first phase (Save) must be connected to a Start Phase action node.


Expand
titleHint

Remember Actionflows cannot pass data between phases. 


Expand
titleSolution



Assignment 2

Difficulty Level: Medium

Task 1

Create a duplication check Actionflow on the Check button on the Government Organisations Form screen. This Actionflow should:

  1. Take the value that the user has entered into the Title field
  2. Embed the Actionflow, Gov Org Validation to standardise the the Title format
  3. Look up into the Government Organisations data for matches 
  4. Count the number of matches returned
  5. Output this count back onto the Government Organisations Form


Expand
titleHint

Click 

Insert excerpt
_actionflow
_actionflow
nopaneltrue
 in the toolbar to display the list of Actionflows in the application. Then drag Gov Org Validation onto the canvas.


Expand
titleHint
  • Review the configuration of the Gov Org Validation Actionflow by right-clicking on the node on the canvas or in the Repository and choosing Display
  • Review the mappings into and out of the Calculate action and the Expression in the Output Attribute, NormalisedGovOrgTitle
    • Note, the Expression requires the attribute, Title, ensure this is mapped in both on the embedded Actionflow and your duplication check Actionflow


Expand
titleHint

The Gov Org Validation Actionflow requires the Title attribute to carry out the validation. Ensure this is mapped into the embedded Actionflow node and the Output Attribute from the Gov Org Validation Actionflow is mapped back to the form.

.

Expand
titleSolution

Actionflow Setup

Mappings - Input Connection Point to Input

Mappings - Input to Embedded Actionflow

Mappings - Embedded Actionflow to Calculate Action

Mappings - Incoming to View Action

Mappings - Outgoing from View Action

View Action Setup

Calculate Action Setup

Mappings - Calculate to Output 

Mappings - Output to Output Connection Point

.


Assignment 3

Difficulty Level: Mild

Task 1

Modify the Actionflow on the Save button on the Government Organisations Form by embedding the Actionflow, Gov Org Validation, before the Save action.

.

Expand
titleSolution

Actionflow Setup

Mappings - Input Connection Point to Input

Mappings - Input to Embedded Actionflow

Mappings - Embedded Actionflow to Save



Testing

Ensure you test your Actionflows are working, and where relevant, test for both a positive and negative result. For example, on your form, enter a Title you know exists in your data to display a duplicate and a Title you know doesn't exist.

Once you have verified your Actionflows are working, the screens and data can be modified in any way you wish. For example, you may wish to enhance the Email phase of the Actionflow that runs the API to pass in more detail to the Email action, such as, the number of records returned from the API call.