Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Section
Column

This tutorial will show how easy it is to create an Approval Workflow using . We will use an Expense Report workflow as an example. Consider this business scenario:

  • The employee accesses the Expense Report workflow and fills in the form, signs it and clicks Continue.
  • sends that employee’s manager a notification.
  • The manager clicks on the notification [on any device], can view the expense report request and approve it or send it back for corrections.
  •  If approved by the manager and the total amount of the expense report is greater than $1000.00, the workflow will be routed to the VP for further approval otherwise it will continue to employees in HR for final processing.
  • Final processing might include integration with a database or with a back end system.

 

Column
width375px

On This Page:

Table of Contents
maxLevel1

...

  1. Click the Manage Users link.
  2. In the Alphabet at the top click All to display a list of the users in the tenant. Follow steps 4 - 7 to create four users:
  3. For each user, click the  icon to add a new user profile.
  4. In the form that's displayed, fill in the information for each user. 
  5. Assign the frevvo. designer role for one user, the Reviewer role for the next user, the Supervisor role for the third user and the Accounting role for the last user.
  6. Select the user's Reviewer from the Reports To drop down for the designer user. Make sure you select the user id for your user with the Reviewer role. Be sure to enter a valid email address that you can access when you are testing the flow.
  7. Click "Submit" to add the user. 

Step 1: Download/Upload the Approval Forms/Workflow Application

  1. Download the Approval Forms/Workflow application  the partially created Expense Report flow to somewhere on your hard drive.  The Download link is not active at this time but it will be functional when v5.3.1 is released on May, 2014.  Until then, we can provide you access to a demo server and the Approval Forms/Workflow application. Please contact us if you would like access. 
     

  2. Login to  as a designer user in your tenant.
     
  3. Click the Upload button on the Application Home page. Browse to the location of the Approval Forms/Workflow application on your hard drive. Click Upload.



  4. The Approval Forms/workflow application will be added to the Application home page.  

Step 2: Create the Workflow

In this step, we will complete ccreate the Expense Report workflow.

  1. Click the Edit button for the Approval Forms/Workflows application on the Application Home page. 

     

  2. Click the Flows tab and then click Edit for the Expense Report flow:   

     
     

  3. At this time, the Expense Report flow only contains the form named Expenses. The Expense report form was created using simple visual drag & drop and edited to achieve the desired layout. To view the form, click the  icon on the flow designer toolbar. 



  4. There are sections in this form for the Reviewer, Supervisor and Accounting approvals. A business rule  controls when these sections are shown/hidden as the flow progresses. For Example, when the employee is filling out the Expense Report, the Reviewer, Supervisor and Accounting sections are hidden.  

    The simple business rule shown below controls when these sections are shown/hidden as the flow progresses.

    Expand
    titleClick here for more information on these rules.This section will expand/collapse by clicking on the arrow.
    Column
    width30%
    Code Block
    if (form.load) {
      ReviewerApproval.visible = false;
      SupervisorApproval.visible = false;
      AccountsPayableOnly.visible = false;
      var an = _data.getParameter ("flow.activity.name");
        if (an === 'Reviewer')  {
            ReviewerApproval.visible = true;
        }
        if (an === 'Supervisor')  {
            ReviewerApproval.visible = true;
            SupervisorApproval.visible = true;
        }
        if (an === 'Accounting')  {
            ReviewerApproval.visible = true;
            AccountsPayableOnly.visible = true;
            if (GrandTotal.value > 1000) {
            SupervisorApproval.visible = true;
            }
        }
    }
    Column
    width70%
    Image Removed

    Image Added

     

    Rules will be even easier to implement in a future release of .  
     

  5. Other Business Rules autofill the Report Date, employee information and the Reviewer name using the credentials of the user who is logged in. Another rule enables/disables the Miles Travelled field based on a selection from the Category dropdown. There is a rule to calculate the mileage and a separate rule to calculate the expense report grand total.    

    Expand
    titleClick here for more information on these rules.This section will expand/collapse by clicking on the arrow.

    This rule populates the Report Date field with the current date when the form loads:

    Code Block
    if (form.load) {
      ReportDate.value = DateUtil.today();
    }

    This rule autofills the First Name and Last Name controls using the credentials of the user who is logged in. The Reviewer for the user filling out the Expense Report comes from the "subject.reports.to" field on the Add/Edit users screen.

    Code Block
    if (form.load && EmployeeName.value.length === 0) {
      EmployeeName.value = _data.getParameter('subject.first.name') { + ' ' +
                          _data.getParameter('subject.last.name');
      EmployeeNameReviewer.value = _data.getParameter('subject.first.name') + ' ' +
                          _data.getParameter('subject.last.name');
      Reviewer.value = _data.getParameter("subject.reports.to");
    }
    This rule enable/disables the Miles Travelled field based on a selection from the Category dropdown. The Miles Travelled control will only be enable for user input when "MIleage" is selected as the Category dropdown choice. Otherwise, the user cannot enter data into the Miles travelled control.
    "subject.reports.to");
    }

    This rule enable/disables the Miles Travelled field based on a selection from the Category dropdown. The Miles Travelled control will only be enable for user input when "MIleage" is selected as the Category dropdown choice. Otherwise, the user cannot enter data into the Miles travelled control.

    Code Block
    for (var i = 0; i < Category.value.length; i++) {
      if (Category[i].value == "Mileage") {
        MilesTraveled[i].enabled = true;
      } else {
        MilesTraveled[i].enabled = false;
      }
    }

    This rule calculates the mileage for each row in the Expenses Table:

    Code Block
    for (var i = 0; i < CategoryMilesTraveled.value.length; i++) {
      if (CategoryMilesTraveled[i].value == "Mileage"> 0) {
        MilesTraveledAmount[i].enabled = true;
      } else {
       value = MilesTraveled[i].enabledvalue =* falseIRSMileageRate.value;
      }
    }

    This There rule calculates adds the mileage amount for each row in the Expenses Table: the table to calculate the Expense Report Grand Total. 

    Code Block
    var tot = 0;
    for (var i = 0; i < MilesTraveledAmount.value.length; i++) {
      if (MilesTraveled[i].value > 0) {
        Amount[i].value = MilesTraveledtot = tot + Amount[i].value;
    *}
     
    IRSMileageRateGrandTotal.value = tot;
    if  }
    }

    There rule adds the amount for each row in the table to calculate the Expense Report Grand Total. 

    Code Block
    var tot = 0;
    for (var i = 0; i < Amount.value.length; i++) {
      tot = tot + Amount[i].value;
    }
     
    GrandTotal.value = tot;
    if (ExpenseRepeat.itemRemoved) {var x;}
  6. Using the  Linked Forms Feature of the flow designer, we can add a linked version of the parent form, Expenses, for each of the remaining steps in the  flow. Click the Image RemovedLink icon three times to create three linked forms. 
     

  7.  Click on the second activity in the flow. Change the name to Reviewer, by typing it in the name field on the left Activity Property pane. Rename the third activity in the flow, Supervisor and the last activity Accounting.  

    Image Removed 

  8. Click the Image Removed icon to save the flow.

Step 3: Assign Roles to the Workflow Steps

We will set up the navigation of the flow by assigning roles/users to the four steps: 

...

This is an example of a template in .  At runtime,  will evaluate the value of the data item (Reviewer), which is automatically filled in via a business rule.  will then send a notification to that specific manager only.  

...

Assign the Supervisor role to the Supervisor activity. 

...

Assign the Accounting role to the Accounting activity. 

...

Click the Image Removed icon to save the flow. 

Step 4: Add a Precondition for the Supervisor Step

Preconditions are used to add logic to your flow to skip or perform a step when the condition is true. Add a precondition on the Supervisor step that will route the workflow to the Supervisor only if the Grand Total of the Expense Report is greater than $1000.00. If the amount of the workflow is less than $1000.00, the workflow will skip this step and route the task to the Accounting step.

...

  1. (ExpenseRepeat.itemRemoved) {var x;}
  2. Using the  Linked Forms Feature of the flow designer, we can add a linked version of the parent form, Expenses, for each of the remaining steps in the  flow. Click the Image AddedLink icon three times to create three linked forms. 
     

  3.  Click on the second activity in the flow. Change the name to Reviewer, by typing it in the name field on the left Activity Property pane. Rename the third activity in the flow, Supervisor and the last activity Accounting.  

    Image Added 

  4. Click the Image Added icon to save the flow.

Step 3: Assign Roles to the Workflow Steps

We will set up the navigation of the flow by assigning roles/users to the four steps: 

  1. Click the Image AddedEdit icon to return to the Expense Report flow.
  2. Select the Activity named Expenses. View the properties window on the left. A scrolling menu lists the available roles. Do not select a role for this step. This assignment makes the first step accessible to everyone in the  tenant. 
  3. Select the Reviewer activity. This step will be perfomed by the employee's manager (Reviewer). We could assign the role, Manager, by selecting it from the Role dropdown list, however, this would put a notification in every manager's inbox as soon as any employee in the company filed an expense report. We want each employee's expenses to be approved/rejected by his/her manager and not by any manager. Instead of assigning a role, we will assign this step to a specific user.  can dynamically determine which user the notification should go to. In the Expense Report Form, there is a text control named "Reviewer." The Reviewer is simply the username of the manager in question. We can use the information entered in that control to forward a notification to the right reviewer. In the Properties window, just below the Role menu, type  {Reviewer} in curly brackets as shown: 

    Image Added 

    This is an example of a template in .  At runtime,  will evaluate the value of the data item (Reviewer), which is automatically filled in via a business rule.  will then send a notification to that specific manager only.  

  4. Assign the Supervisor role to the Supervisor activity. 

  5. Assign the Accounting role to the Accounting activity. 

  6. Click the Image Added icon to save the flow. 

Step 4: Add a Precondition for the Supervisor Step

Preconditions are used to add logic to your flow to skip or perform a step when the condition is true. Add a precondition on the Supervisor step that will route the workflow to the Supervisor only if the Grand Total of the Expense Report is greater than $1000.00. If the amount of the workflow is less than $1000.00, the workflow will skip this step and route the task to the Accounting step.

To add the precondition:

  1. Click the Image AddedEdit icon to return to the Expense Report flow.  
  2. Click on the Supervisor step.  
  3. Type GrandTotal.value > 1000 into the Precondition field on the left Activity Property pane. GrandTotal is the name of the Total Amount control in the Expenses form.  

    Image Added
  4.  Click the Image Added icon to save the flow.  

Step 5: Customize Notifications

The designer can customize the messages the users see, the task information that appears in the Task List, the messages the users see at the completion of each step, etc. We will supply some exampes for you here but you can change these messages to say anything you want. Notice some control names are in between curly brackets. These are examples of templates - controls in your form that are evaluated at runtime and replaced with the actual value entered. 

Follow the steps below to add some examples to the Expense Report flow

  • Click the Image ModifiedEdit icon to return to the Expense Report

...

Step 5: Customize Notifications

The designer can customize the messages the users see, the task information that appears in the Task List, the messages the users see at the completion of each step, etc. We will supply some exampes for you here but you can change these messages to say anything you want. Notice some control names are in between curly brackets. These are examples of templates - controls in your form that are evaluated at runtime and replaced with the actual value entered. 

Follow the steps below to add some examples to the Expense Report flow

  1. Click the Image RemovedEdit icon to return to the Expense Report flow.  

...

Column

Image Removed

...

  1. Type HM1: Expense Report from {EmployeeName} for ${GrandTotal} into the History Msg field on the Activity Property pane on the left. HM1 stands for History Message for the first step. The subsequent messages are numbered to distinguish them from each other when you test the flow. You will see this in the audit trail for the flow. The control name {EmployeeName} will be replaced by the with the user's name and the control name {GrandTotal} with the total amount of the Expense Report. 

...

  • flow.  
Section
Column

Image Added

Image Added

Column
  1. Click on the Expenses step. 
    1. Type HM1: Expense Report from {EmployeeName} for ${GrandTotal} into the History Msg field on the Activity Property pane on the left. HM1 stands for History Message for the first step. The subsequent messages are numbered to distinguish them from each other when you test the flow. You will see this in the audit trail for the flow. The control name {EmployeeName} will be replaced by the with the user's name and the control name {GrandTotal} with the total amount of the Expense Report. 
  2. Click on the Reviewer Step. 
    1. Type TI2: Expense report for ${GrandTotal}.into the Task Info field on the Activity Property pane. You will see this message on the Task List for this step. 
    2. Type PM2: Your request has been sent to {Reviewer} into the Pending Message field on the Activity Property pane. The employee will see this message when he/she submits the form and the task is placed on the Reviewer's Task List 
    3. Type HM2: Expense Report from {EmployeeName} for ${GrandTotal}. This message will be added to the audit trail for this step. 
  3. Click on the Supervisor Step. 
    1. Type TI3: Expense report for ${GrandTotal}.into the Task Info field on the Activity Property pane. You will see this message on the Task List for this step. 
    2. Type PM2PM3: Your This request requires extra approval and has been sent to {Reviewer}the Supervisor. into the Pending Message field on the Activity Property pane. The employee Reviewer will see this message when he/she submits the form and if the task is placed on the Reviewer's Task List Type HM2routed to the Supervisor because the total amount is greater than $1000.00. 
    3. Type HM3: Expense Report from {EmployeeName} for ${GrandTotal}. This message will be added to the audit trail for this step. 
  4. Click on the Supervisor Accounting Step.: 
    1. Type TI3Type TI4: Expense report Report from {EmployeeName} for ${GrandTotal}.into the  into the Task Info field  field on the Activity Property pane. You will see this message on the Task List for this step. 
    2. Type PM3Type PM4: This Your request requires extra approval and has been sent to the SupervisorAccounting for paymentinto the Pending Message field on the Activity Property pane. The Reviewer will see this message if the task is routed to the Supervisor because the total amount is greater than $1000.00. Type HM3Property pane.
    3. Type TI4: Expense Report from {EmployeeName} for ${GrandTotal} into the Task Info field on the Activity Property pane. You will see this message on the Task List for this step. 
    4. Type PM4: Your request has been sent to Accounting for paymentinto the Pending Message field on the Activity Property pane.
    5. Type HM4: Expense Report from {EmployeeName} for ${GrandTotal} into the History Msg field on the Activity Property pane on the leftType HM4: Expense Report from {EmployeeName} for ${GrandTotal} This message will be added to the audit trail for this step. 
    Click on the Accounting Step: 
    1. into the History Msg field on the Activity Property pane on the left. 
    2. If you want to display a custom message such as "Expense Report Processing for {EmployeeName} is complete." after the Accounting user clicks Continue, click the Image Added what does the user see icon? on the flow designer toolbar to display the Form Action wizards , click on Display Message when users submit your form. Type your message in the Message box.  Select the EmployeeName control from the control dropdown list. Click Finish.

  5. Be sure to save the flow when these additions are completed.

...

Share URL:  Click the  Share icon for the workflow on the Flows Home Page and select the third option: Link (Email/Web page). Copy this link and paste it into a different browser.  will display the login screen. Continue with the Employee Submission section below:

Spaces:  A   space is a frevvo website that can be used to test the Expense Report flow. It is very easy to create and add your forms and workflows to it. Follow these steps to create the space:

  1. Ensure the visibility of your Expense Report flow is set to public and that it is deployed to production: 
    Image Modified 
  2. Click on the Spaces Tab. Click the Image Modified icon. Enter an id and name for your space. Click Create.
  3. Click the Image Modified Share icon. Copy the share url for your space then logoff . Paste the space url into another browser or a new tab of the browser you are using. Login as your designer user.

    Image Modified
     
  4. Your space will look similar to the image below. 

     

...

Fill in and sign the Accounting section. Click Finish to complete the workflow. The Accounting user should see the message "Expense Report Processing for {emloyeename} is complete.Logoff.

Run the Expense Report workflow with a Grand Total that is less than $1000.00. Verify that the Supervisor step is skipped. 

...