Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 9 Next »

 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.  

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.

 Assignment Hint

You may find it useful to use the debug function within your Expressions to add messages to the System Console.


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

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

 Hint

Use a Lookup   View action to return the Employee IDs.

 Hint

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

 Hint

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

.

 Solution

Step 1: Employee Lookup Setup

Step 2: Calculate Action Setup

Step 3: Bulk Delete Employees Setup

Step 4: Mappings - Calculate to Bulk Delete


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


 Hint

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


 Solution

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
 Hint

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

 Hint

In the Confirmation Phase, use Lookup   View actions to retrieve the records for the rejected companies.


 Hint

Use a  Calculate to perform the counts.

 Hint

Use a  Calculate to create an array (Structured Data) of the rejected Company IDs, which can then be used in the Lookup   View action filters to retrieve the orders and employees for the rejected companies only.

 Solution

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  Bulk Update 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
 Hint

Use a  Calculate action to generate the website.

 Hint

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

.

 Solution

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

Set up an  API Endpoint that returns the attributes CoID, Name, Industry, Status and TurnOver from the Additional Companies data in JSON.

On the Company Approval Review screen, create a button that calls the API. The Response from URL can be seen in the  System Console.

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


 Testing

View the response from the API in the System Console.

.

 Solution

API Endpoint Setup

Mappings - Input to Calculate

Lookup View Setup

Calculate Setup - Constructed JSON

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

Actionflow Setup

Actionflow Setup - Including Optional Screen Display

System Console - Response from URL


Task 2  BROKEN

On the Turnover Analysis screen, add an Actionflow to the Run button that displays Companies from the Additional Companies API with a turnover between two set parameters.

Set drop down boxes - 250,000

OR


 Solution

API Endpoint Setup

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


Actionflow Setup



Task 3

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  For Each 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 and when saving, unique ID numbers are generated for each company and the company's Status is set to New. These companies will then appear on the Company Approval Review screen.

 Solution

Actionflow Setup

Mappings - Screen to Input

Calculate Setup

Mappings - Calculate to For Each

For Each Setup

Mappings - For Each to Save

Save Setup


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.

  • No labels