Versions Compared

Key

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

Insert excerpt
_Banners
_Banners
nameactionflow
nopaneltrue

Image Modified Training Exercise

You have now learnt how to create and configure Actionflows requiring advanced business logic and can competently use all Actionflow features. 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 Advanced Application.

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


Expand
titleAssignment HintHints
  • You may find it useful to use the debug function within your Expressions to add messages to the System Console
    • Example:
Code Block
themeEmacs
titleOriginal Expression
countElements(in.Colours)


Code Block
themeEmacs
titleExpression with Additional Debug
do(
	debug("This is a count of colours: " + in.Colours),
	countElements(in.Colours)
)


  • For each task, one solution is provided. It is important to note that this is just one solution and there may be others

Assignment 1

Difficulty Level: 

Task 1

When deleting rejected companies in bulk, we need to also delete all employees associated with that company from the application. 

  • On the Company Rejected Companies screen, modify the Actionflow that you created in 3.01 Bulk Delete Action Configuration on the Delete All button to also delete all employees associated with the rejected companies
Tip

Before starting, roll back and reinstate the data in the Companies, Orders and Order Lines tables, if you have not already.


Use a Lookup  action to return the Employee IDs.
Expand
Expand
titleHint
Insert excerpt
_action_view_action_view
nopaneltrue
Expand
titleHint

Add an Output Attribute to the Calculate action that converts the Employee IDs to structured data.

titleHint- Setting up Bulk Delete Action

Remember to set a filter on the Bulk Delete action containing the criteria of the records to be deleted. 


Expand
titleHint - Bulk Delete Filter

As the Company ID is in the Employees data, this can be used to delete the related employees.

.

Expand
titleSolution

Step 1: Employee Lookup SetupImage RemovedMappings - Calculate to Bulk Delete

Image Added

Step 2: Calculate Action Setup

Image Removed

Step 3: Bulk Delete Employees Setup

Image Removed

Step 4: Mappings - Calculate to Bulk Delete

Image RemovedImage Added


Task 2

On the Company Approval Review screen, the area holding the  icon requires setup to allow companies to be dragged and dropped onto this area and then subsequently rejected.

The Actionflow must:

  • Set the Company's Status to Rejected
  • Update the Company's UpdatedByName attribute, using the same syntax as can be seen in the existing data
  • Update the Company's UpdatedTime attribute


Expand
titleHint - Not sure where to start?

Revisit the worked example on 3.04 Drag and Drop Configuration to familiarise yourself with the drop target and Actionflow setup.


Expand
titleSolution

Drop Target Setup

Mappings - Drag Type to Input

Mappings - Input to Calculate

Calculate Setup

Mappings - Calculate to Save

Save Setup



Assignment 2

Difficulty Level: Medium

Task 1

When deleting rejected companies in bulk, we need to provide the user with more details, such as counts of the companies, orders and employees that will be affected by the deletion. In addition, we should give the user the ability to cancel or confirm the deletion using this information.

  • Add the confirmation screen, Company Bulk Delete Confirmation, to the Actionflow on the Delete All button on the Company Rejected Companies screen
  • In the Actionflow, create counts of the affected companies, orders and employees, and map these onto the screen


Expand
titleHint - Not sure where to start?

Add a Confirmation Phase before the Processing Phase on the BulkDeleteRejectedCompanies Actionflow.


Expand
titleHint - How to get the records to perform the count

In the Confirmation Phase, use Lookup 

Insert excerpt
_action_view
_action_view
nopaneltrue
 actions to retrieve the records for the rejected companies.


Expand
titleHint - How to perform the count

Use a 

Insert excerpt
_action_calculate
_action_calculate
nopaneltrue
 to perform the counts.


Expand
titleHint - How to use the records from a lookup to filter another lookup

Use a 

Insert excerpt
_action_calculate
_action_calculate
nopaneltrue
 to create an array (Structured Data) of the rejected Company IDs, which can then be used in the Lookup 
Insert excerpt
_action_view
_action_view
nopaneltrue
 action filters to retrieve the orders and employees for the rejected companies only.


Expand
titleSolution

Actionflow Overview and Calculate Action Setup

Rejected Companies - Lookup View Setup 

Rejected Orders - Lookup View Setup 

Rejected Employees - Lookup View Setup 

Mappings - Calculate to Open Screen


Task 2

A number of companies have created webpages on their company website for their employees. The website for the employees is the company website followed by "/employeeportal" .

  • On the Company Management screen, expand the AdditionalDetails area on the Employees card and find the dynamic text component, Website
  • This component is backed by the attribute, Website, which is currently empty
  • On the Company Form screen, add an Actionflow to the Update Employee Website button that updates the Website attribute on the Employee table using a 
    Insert excerpt
    _action_bulkupdate
    _action_bulkupdate
    nopaneltrue
     action
  • Every employee for the selected company should be updated
  • The syntax for the employee website is CompanyWebsite/employeeportal, e.g. www.phixflow.com/employeeportal


Expand
titleHint - How to generate the website

Use a 

Insert excerpt
_action_calculate
_action_calculate
nopaneltrue
 action to generate the website.


Expand
titleHint - How to configure the Bulk Update action

Remember to set a filter on the Bulk Update action containing the criteria of the records to be updated.

.

Expand
titleSolution

Actionflow Setup


Mappings - Screen to Input

Mappings - Input to Calculate

Mappings - Calculate to Bulk Update

Bulk Update Setup

Company Management - Screen Setup 

.


Assignment 3

Difficulty Level: 

Task 1

BROKEN

We need a way to quickly create a number of companies where we have limited information about them, e.g. just their name.

  • On the Company Management screen, click the Quick Add button to open the Company Quick Add screen
  • On this screen, add an Actionflow to the Save button, using a
    Insert excerpt
    _action_for_each
    _action_for_each
    nopaneltrue
     action, that allows new companies to be added to the Companies table using just their name
  • Users should be able to enter a list of company names, separated by a comma
  • When a record for each company is created, a unique ID number should be generated
  • Each company's Status should be set to "New" so that they populate the Company Approval Review screen


Expand
titleHint - How to split the list

Use a 

Insert excerpt
_action_calculate
_action_calculate
nopaneltrue
 action to split in the incoming list, by the comma separator, into an array. 


Expand
titleHint - How to remove white space in the array

Use the trim function to trim white space on the array values being mapped out of the  

Insert excerpt
_action_for_each
_action_for_each
nopaneltrue
 action. Remember values returned by the Input Expression are available in the Output Attribute's expressions as _result.value.


Expand
titleSolution

Actionflow Setup

Image Added

Mappings - Screen to Input

Image Added

Calculate Setup

Image Added

Mappings - Calculate to For Each

Image Added

For Each Setup

Image Added

Mappings - For Each to Save

Image Added

Save Setup

Image Added


Task 2

Additional information about all employees has been made available. We need to make sure it is available across all applications and can be called by external systems as an API.

Set up an 

Insert excerpt
_actionflow_api_endpoint
_actionflow_api_endpoint
nametext
nopaneltrue
that returns the attributes CoID, Name, Industry, Status and TurnOver from the Additional Companies data in JSON.On the Company Approval Review all the data from the table, EmployeesAdditionalInformation in JSON format. This table can be found in your application under 
Insert excerpt
_tables
_tables
nopaneltrue
s in the Repository. 

On the Company Employee Extra Information screen, create a button that calls the API. The Response from URL can be seen in the

Insert excerpt
_console
_console
nopaneltrue
.

Optional: If you wish, you can create a screen to display the results.


Expand
titleTesting

View the response from the API in the System Console.

.

Hint - How to use the toJson Function

On the 

Insert excerpt
_actionflow_api_endpoint
_actionflow_api_endpoint
nametext
nopaneltrue
, use the toJson function in a
Insert excerpt
_action_calculate
_action_calculate
nopaneltrue
 action to convert the data returned from the lookup to JSON. The syntax is toJson(lookupConnector).


Expand
titleHint - Tips for the Lookup

On the 

Insert excerpt
_actionflow_api_endpoint
_actionflow_api_endpoint
nametext
nopaneltrue
, remember to configure the Output Attributes and the Return (Outgoing) Mappings for the lookup. Also, no filter is needed on the lookup as we want to return all data.


Expand
titleHint - Tips for API Endpoint Mappings

On the 

Insert excerpt
_actionflow_api_endpoint
_actionflow_api_endpoint
nametext
nopaneltrue
, remember to map the JSON attribute from the Calculate to the body attribute on the output.


Expand
titleHint - How to ensure the URL Response is logged in the System Console

On the Actionflow calling the API, ensure Log Traffic to enabled on the HTTP action so that the Response from URL is logged.


Expand
titleTesting Tip

In the

Insert excerpt
_console
_console
nopaneltrue
, find the Completed Task for the Actionflow calling the API and click on it to view the Messages. Double-click on the Response from URL, then click on Message Detail tab to see the JSON returned.

.

Expand
titleSolution

API Endpoint Setup

Image RemovedImage Added

API Endpoint Setup - Mappings - Input to Calculate

Image RemovedImage Added

API Endpoint Setup - Lookup View Setup

Image RemovedImage Added

API Endpoint Setup - Calculate Setup - Constructed JSON

Image Removed

Code Block
do(
    // Get the number of companies
    $count = countElements(lu.Name),
    
    //  Create an array with an item for each company
    $countList= [],
    $countList = 1..$count,
    
    //Initiate the output
    $output = '{\n"output":[\n',
    
    // Create the JSON output to be returned by the API
    forEach($var, $countList, 
    
        // Get the record details
        $CID       = getElement(lu.CoID,$var),
        $CName     = getElement(lu.Name, $var),
        $CStatus     = getElement(lu.Status, $var),
        $CTurnOver     = getElement(lu.TurnOver, $var),
        $CIndustry = getElement(lu.Industry, $var),
     
        //Construct the JSON text 
        $output = $output +
        
        // Add a tab for the first record's bracket
        if($var == 1, '\t')+
        '{\n'+
        '\t\t"CompanyID": '  + $CID + ',\n' +
        '\t\t"CompanyName": "'  + $CName + '",\n' +
        '\t\t"Status": "'  + $CStatus + '",\n' +
        '\t\t"TurnOver": '  + $CTurnOver + ',\n' +
        '\t\t"Industry": "'  + $CIndustry + '",\n'+
        '\n\t}'+
        
        // Add a comma, except for the last record
        if($var != $count, ',')
    ),
    
    // Finalise output
    $output = $output + '\n\t]\n}',
    
    
    // Output
    $output
)

Mappings - Calculate to Output

Image Removed

Actionflow Setup

Image RemovedImage Added

API Endpoint Setup - Calculate to View - Request (Incoming) Mappings

Image Added

API Endpoint Setup - View to Calculate - Return (Outgoing) Mappings

Image Added

API Endpoint Setup - Mappings - Calculate to Output

Image Added

Actionflow Setup

Image Added

Actionflow Setup - Including Optional Screen Display

Image RemovedImage Added

System Console - Response from URL

Image Removed

Task 2  BROKEN

On the Onboarded Analysis

Image Added


Task 3 

We need to call the API containing the additional information about employees to obtain their start dates.

On the Company Employee Extra Information screen, add an Actionflow to the Run button that displays Companies Employees from the Employees Additional Companies API Information API you set up in Assignment 3, Task 1 2 above, with an onboarded a start date between the two set parameters as shown in the drop down fields on the Company Employee Extra Information screen.

For this task, you can either create a new Actionflow or modify to the one you made in the task above.

Expand
titleSolution

API Endpoint Setup

The API Endpoint setup in Task 1 requires a JSON action to allow it to receive parameters.

Actionflow Setup

Task 3

We need a way to quickly create a number of companies where we have limited information about them, e.g. just their name.

  • On the Company Management screen, click the Quick Add button to open the Company Quick Add screen
  • On this screen, add an Actionflow to the Save button, using a

    Requirements:

    • Your Actionflow must contain a 
      Insert excerpt
      _action_loop
      _action_loop
      nameloop
      nopaneltrue
       and loop through each year parameter
    • Set up a
      Insert excerpt
      _action_json
      _action_json
      nopaneltrue
       action on the API endpoint to receive the incoming parameters

    Optional Task: For the purposes of this example we save the data to the table Employee Start Date Analysis but you can use the Employee ID to merge the Start Dates into the Employees table.


    Expand
    titleHint - Not sure where to start?

    Look at the Actionflow setup on 3.08 Loop Action Configuration to help with setup.


    Expand
    titleHint - How to filter the data being returned from the lookup

    On the API endpoint, use the incoming parameters to filter the data being returned from the lookup.


    Expand
    titleHint - How to perform a type conversion

    Use a 

    Insert excerpt
    _action_

    for_each

    calculate
    _action_

    for_each

    calculate
    nopaneltrue

     action, that allows new companies to be added to the Companies table using just their name
  • Users should be able to enter a list of company names, separated by a comma
  • When a record for each company is created, a unique ID number should be generated
  • Each company's Status should be set to "New" so that they populate the Company Approval Review screen
  • Expand
    titleSolution

    Actionflow Setup

    Image Removed

     to convert the data entering the Actionflow into an integer.


    Expand
    titleHint - Renaming Attributes Tip

    Rename the From attribute going into the HTTP action to make it easier to distinguish it from the From attribute elsewhere in the Actionflow.


    Expand
    titleHint - HTTP Syntax Help

    On the HTTP action, pass in parameters using curly { } brackets.


    Expand
    titleHint - Tips on setting the Max Loops

    On the End Loop action, set the Max Loops to be a sensible number. In this example, the maximum number of loops that can occur is 4 as a loop is processed for each date in the drop down field on the Company Employee Extra Information screen (2018-2021).


    Expand
    titleSolution

    The API Endpoint (setup in Task 2) requires a JSON action to allow it to receive parameters that can be used in the lookup filter.

    API Endpoint Setup - JSON

    Image Added

    API Endpoint Setup - Mappings - Input to JSON

    Image Added

    API Endpoint Setup - Mappings - JSON to Calculate

    Image Added

    API Endpoint Setup - Calculate to View - Request (Incoming) Mappings

    Image Added

    API Endpoint Setup - View/Lookup

    Image Added

    Actionflow Setup

    Image Added

    Actionflow Setup - Mappings - Screen to Input

    Image Removed

    Calculate Setup

    Image Removed

    Mappings - Calculate to For Each

    Image Removed

    For Each Setup

    Image Removed

    Mappings - For Each to Save

    Image Removed

    Save Setup

    Image RemovedImage Added

    Actionflow Setup - Mappings - Input to 'Convert to Integer' Calculate

    Image Added

    Actionflow Setup - 'Convert to Integer' Calculate

    Image Added

    Actionflow Setup - Mappings - 'Convert to Integer' Calculate to Loop Start

    Image Added

    Actionflow Setup - Mappings - Loop Start to HTTP

    The attribute has been renamed on the HTTP side of the Mappings by right-clicking and clicking 

    Insert excerpt
    _edit
    _edit
    nopaneltrue

    Image Added

    Actionflow Setup - HTTP

    Image Added

    Actionflow Setup - Mappings -  HTTP to JSON

    Image Added

    Actionflow Setup - JSON 

    Image Added

    Actionflow Setup - Mappings -  JSON to Save

    Image Added

    Actionflow Setup - Save

    Image Added

    Actionflow Setup - Mappings - Save to 'Increment By 1' Calculate

    Image Added

    Actionflow Setup - 'Increment By 1' Calculate

    Image Added

    Actionflow Setup - Mappings - 'Increment By 1' Calculate to End Loop

    Image Added

    Actionflow Setup - End Loop

    Image Added

    Actionflow Setup - Mappings - End Loop to Start Loop

    Image Added



    Testing

    Ensure you test your Actionflows are working, and where relevant, test for both a positive and negative result. 

    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 add additional screens to process the Employees data and practice some of the techniques you have learnt using that data.