/
Leave Approval Workflow Tutorial

Live Forms v6.3 is no longer supported. Click here for information about upgrading to our latest GA Release.

Leave Approval Workflow Tutorial

On This Page:

What are we going to build?

A common example of a workflow is a Leave Approval , where an Employee requests vacation and the Manager must either approve it, reject it or send it back to the Employee for corrections. Typically, the process is paper or email-based. The Employee fills out a paper form and hands it to the Manager for a signature. The form is then faxed or delivered to HR where it is saved in a folder or scanned into the HR or document management system.

Using Live Forms, you can automate this workflow so that it is completely electronic and paperless. Further, you can integrate the workflow with Google Apps, a document management system such as Digitech ImageSilo/PVE, your database or custom business system so that the leave approvals are stored online.

The steps are as shown in the figure:

  1. The Employee goes to a web page that embeds the workflow. Live Forms makes this very easy to do.
  2. The form is configured so that the Employee only sees the relevant portion of the form, i.e. the Employee does not see the Manager approval section or the HR Review section. The Employee information and Manager id are automatically populated by .
  3. The Employee fills in the form, digitally signs it and clicks a Submit Request button.
  4. puts the leave approval request on the specific Manager's task list, [optionally] notifies the Manager by email and displays a confirmation message to the Employee.
  5. When the Manager logs in, she visits a web page that displays an electronic task list.
  6. All pending leave approval requests will be displayed in the task list.
  7. The Manager clicks to perform an approval. The Manager-specific portions of the form are now visible. The data entered by the Employee is automatically populated for the Manager to review.
  8. If the Manager requires corrections, she can send the form back to the Employee to make changes.
  9. Once she approves, she digitally signs the form and clicks Submit Request.
  10. In the final step, the workflow is sent to the HR department to update records and/or comments.
  11. The form data along with a PDF image can be electronically saved in a back end system such as Google Drive, ImageSilo/PVE, your HR system etc. The data will also optionally be saved in ' submissions repository.
  12. Finally, the original requesting Employee is notified by email.

Setup users and roles

This is a one-time setup that will have to be performed by an administrator.

In our example, the company org chart is as shown above.

We will need to create two roles, Manager and HR. To create these roles in :

  1. Login to as the administrative user for your tenant.
  2. On the page that is displayed, click the 'Manage Roles' link.
  3. Click the icon and in the form that is displayed type in the desired role. Note that role names are case sensitive.
  4. Repeat for the second role.

The admin user will also need to follow the steps below to setup the users shown in the org chart.

If you are using LDAP or Active Directory, you can use the hierarchy from that server.

  1. Login to as the tenant admin.
  2. On the page that is displayed, click the 'Manage Users' link.
  3. In the Alphabet at the top click All to display a list of the users in the tenant. If the users shown in the company org chart above are not listed, perform steps 4 - 8 to add them.
  4. For each user, click the  icon to add a new user profile.
  5. In the form that's displayed, fill in the information for each user shown in the company org chart shown above.
  6. Be sure to select the role specified in the company org chart for each user.
  7. Select the user's Manager from the Reports To drop down. For example, Jerry is the manager for Tom and Leonard and Jill is the manager for Jack. Jill and Jerry report to Hanna.
  8. Click "Submit" to add the user.
  9. If you are using Active Directory or LDAP, you do not need to do this.

Create the Leave Approval form

Read the general documentation on designing forms for a detailed discussion of and their features. In particular, make sure you understand the Name property of a control.
  1. Logon to your tenant as a designer user.
  2. Click the  New icon to add a new application.
  3. Click the  Properties icon. Change the name of the application to My Company HR. Click Update.
  4.  Click the  Edit icon for the My Company HR application.
  5. Click the  New icon to create the Leave Approval form. 
  6. he New Form wizard displays listing any forms that have been published as templates. SInce there are none listed, click Finish to accept the Blank template for your form..

  7. Change the name of the form to Leave Approval Form on the form Properties pane.

  8. Create the Leave Approval form with the four sections described below. 

Employee Information Section

  1. Drag and drop controls as shown in the image above.
  2. We have created a section with Employee information containing controls Id, Manager Id, Name, and Email.
  3. Make sure that the Name field of each control is properly set. This is a critical step to ensure that business rules work. The controls are named as shown in the table below. Make sure that the Control Name field is exactly as shown below including case-sensitivity. You may label the controls whatever you want.
  4. Uncheck the Enabled checkbox for each control and check the Required checkbox. The control values will be automatically filled in by a business rule.
Control Label Control Name Description
IdEldThe login id of the currently logged in Employee (user)
Manager IdMIdThe login id of the current user's Manager
NameEFullNameThe current user's full name
EmailEEmailThe current user's email address

Leave Request Section

This section is filled in by the Employee who is requesting the leave.

  1. Drag and drop controls as shown in the image.
  2. We've placed Start Date, Number of Days, Type of Leave, Certification and Comments controls as shown.
  3. Select the Leave Request section by clicking on its header.
  4. In the properties panel, select the Security Tab.
  5. This is considered a Signed Section. Two types of signatures are available from the Signature drop down: Text/Signature Image or Wet Signature. Here is information about the difference between the signature types. Select Wet Signature from the dropdown. 
  6. Check the Must Sign checkbox to require the signature and verify that the Lock checkbox is checked to prevent tampering with the signed data .
  7. Notice that a "Sign this section" button and an icon and a line appear at the bottom right and left of the section when the signature type is selected. 
  8. The Employee will have to sign the section before it can be submitted.
  9. Do not forget to uncheck the Visible checkbox on the Certification field. This field is not visible on the form unless the Employee selects Sick Leave as the Type of Leave. This will be handled by a rule that will be discussed later in the tutorial.

Manager Approval Section

This section is used by the Manager to approve or deny the leave request. We will set up the Quick View  feature so that the Manager will have a quick way to approve or reject the task from their Task List when we create the Leave Approval workflow. This is convenient particularly if this part of the workflow is performed on a mobile device. An Approval control is required for this feature. An Approval control is a section that contains only one textarea control and can be optionally set up for a digital signature. Follow these steps to create the Approval control so we can incorporate the Quick View feature when we create the Leave Approval workflow:

  1. Drag and drop a Section control. Name the section Manager Approval.
  2. Add a text area control with 3 lines and name the control Comments.
  3. Select the section by clicking on its header.
  4. In the properties panel, select the Security Tab.
  5. In the Roles multi-select, select the roles Manager and HR by holding down the Control key and clicking. This section will only be visible to the Manager and to the subsequent HR reviewer.
  6. Select Text/Signature Image from the signature dropdown. As before, check the Must Sign checkbox to require a signature and verify that the Lock checkbox is checked to prevent tampering with the signed data .

HR Review Section

This section is for the HR reviewer and is similar to the Manager approval section.

  1. Drag and drop a Section control. Name the section HR.
  2. Drag and drop text controls for HR name and email.  We've labeled the controls Name and Email but the Name property of the control contains HFullName and HEmail. Once again, the form will fill in this control automatically. We'll use the value from this control to create a meaningful audit trail for the workflow.
  3. We've also added an optional Comments field.
  4. As before, in the Security Tab, select the HR role to restrict viewing of this section to HR Employees.
  5. Select Text/Signature Image from the Signature dropdown and check the Must Sign checkbox to make the signature required.

Business Rules

Click on the  rules icon in the toolbar to create a rule to initialize the form and a second one to make the Certification control visible when Sick Leave is selected as the Type of Leave. The Rule Validator can help troubleshoot any issues with rules.

Your form will contain two business rules: the first one automatically initializes various fields in the form and hides irrelevant sections. This rule is shown below:

  • We first get the name of the current step (step).
  • If the step name is Employee and the Employee ID is blank, we'll initialize several fields as shown below. If the Employee ID already contains a value (e.g. if the Manager sends it back to the Employee for corrections), we do not wish to overwrite the data.
  • If the step name is Employee, we also want to hide the Manager Approval and HR sections. This will happen automatically if the user does not have the Manager role but remember that Managers are also Employees and might request leave that must be approved by their supervisor.
  • The rule also contains initializations to be performed in the Manager and HR steps of the workflow.

It is very important to ensure that the Names of the controls in the form exactly match the names used in the rule below and that the names used in a rule are unique across the form.

Here is an example of a rule that will satisfy the four requirements listed above:

if (form.load) {
    var an = _data.getParameter("flow.step.name");
    if (an === 'Employee') {
        EId.value = _data.getParameter('subject.id'); // Username
        EFullName.value = SubjectUtil.getFullName(_data.getParameter('subject.first.name'), _data.getParameter('subject.last.name'));
        EEmail.value = _data.getParameter('subject.email');
        MId.value = _data.getParameter('subject.reports.to');
    } else if (an === 'HR') {
        HFullName.value = SubjectUtil.getFullName(_data.getParameter('subject.first.name'), _data.getParameter('subject.last.name'));
        HEmail.value = _data.getParameter('subject.email');
    }
}

Add a second rule to make the Certification field visible when Sick Leave is selected as the Type of Leave:

if (TypeOfLeave.value === 'Sick') {
  Certification.visible = true;
  Certification.required = true;
} else {
  Certification.visible = false;
  Certification.required = false;
}

When you are satisfied with the rules, click the Finish button to save the Rules and then again to save the updates to the flow and return to the Flow Designer. We're now done with the form.

Creating the Leave Approval Workflow

Read the general documentation on designing flows for a detailed discussion of workflows and their features

Setup the steps in your workflow

  • Create a new flow by clicking on the Flows menu item and clicking the New  button.
  • Drag and drop the Leave Approval form you just created into the flow. This creates a step (step) in the workflow.
  • Name the step 'Employee' by typing the name in the Name property.
  • In our example, we will use the same form three times, once for the Employee, Manager and HR.
  • Select the Employee step and click the  icon twice.
  • This will create two linked steps. A linked step refers to the same form as the original step. The form cannot be edited from a linked step but any edits made to the original form are reflected in the linked steps.
  • Name the second step Manager and the third step HR.

Setup roles/users for steps

  1. Click the Employee step. Do not select a role for this step.
  2. Click the Manager step and in the User property type in the string {MId}. Remember that the control in the form for the Manager Id was named {MId}. When the workflow runs,  will resolve the string {MId} to the value of the control from the form and will forward the approval request to the specific Manager.
  3. For the HR step, select the HR role.

Set flow properties

  1. Click the toolbar at the top of the flow.
  2. Check the Save PDF box to generate and save a PDF in the repository.
  3. In the Navigation drop down select the type of navigation toolbar you want  to generate.
  4. Click the