Automate HR processes using Microsoft Teams, PowerApps and Power Automate. Employee leave requests

Good day to all! Today I'd like to share a small example of automating the process of creating new employee requests using Microsoft SharePoint products, PowerApps, Power Automate and Teams. This process does not require the purchase of separate PowerApps and Power Automate user plans, an Office365 E1/E3/E5 subscription will suffice. On the SharePoint site, we will create lists and columns, PowerApps will help to make a form, and Power Automate will provide opportunities for customizing business process logic. We will connect the final process to the MS Teams team. Let's not waste time and see what happens.

Automate HR processes using Microsoft Teams, PowerApps and Power Automate. Employee leave requests

At the first stage, we create lists and details. We need lists:

  1. Employee leave requests
  2. unit
  3. HR by departments
  4. Administrators

Each list will play its role in the future, and we will see which one. Create props and set up the navigation menu:

Automate HR processes using Microsoft Teams, PowerApps and Power Automate. Employee leave requests

Power Apps

Now, let's make a form for the "Employee Leave Applications" list using PowerApps. In the final form, it will look like this:

Automate HR processes using Microsoft Teams, PowerApps and Power Automate. Employee leave requests

In the "Employee" field, a selection is made from the list of Office 365 users, "Exit Date" is indicated from the calendar, "Department" is indicated from the directory of departments, and "HR" is selected from the directory "HR by departments":

Automate HR processes using Microsoft Teams, PowerApps and Power Automate. Employee leave requests

But it is necessary to make sure that the list of HR available for selection is filtered by the unit indicated on the form. Let's use a formula to filter data in PowerApps. For the "Items" property of the "HR" field, write:

Automate HR processes using Microsoft Teams, PowerApps and Power Automate. Employee leave requests

Additionally, you can make small adjustments to the default value of the Status field on the form. For the "Default" property of the "Status" field, write:

Automate HR processes using Microsoft Teams, PowerApps and Power Automate. Employee leave requests

If the item creation form is opened, then the value "New" will be written in the "Status" field, otherwise, the value from the SharePoint column for the current item will be substituted into the status field on the form.

One of the problems with PowerApps is the inability to easily retrieve data from SharePoint groups. In this regard, it is not possible to easily configure the visibility / availability of fields or objects on the form if you wanted to get involved in the user's entry into the SharePoint group. But you can make a workaround. Especially for this, we have previously created a list of Administrators:

Automate HR processes using Microsoft Teams, PowerApps and Power Automate. Employee leave requests

This list contains an "Employee" field with the "User or Group" type, displayed only on the form, and a "Name" field in which the name of the selected employee is written, displayed only in the list view. Now, let's do a little trick in PowerApps. For example, you can set the availability of any field to the condition that the current user is in the Administrators list. Find the "Display Mode" property of the "Release Date" field and write:

Automate HR processes using Microsoft Teams, PowerApps and Power Automate. Employee leave requests

According to this formula, if there is at least one employee in the Administrators list whose login matches the login of the current user, then the field will be available for editing, otherwise, for viewing. For greater reliability, we bring the login to lower case, otherwise there are all sorts of cases.

You may have noticed that in the form header there is a button "Actions on the application":

Automate HR processes using Microsoft Teams, PowerApps and Power Automate. Employee leave requests

This button will switch to another screen, where, for convenience, all possible actions on the application are collected:

Automate HR processes using Microsoft Teams, PowerApps and Power Automate. Employee leave requests

After clicking on each button, an additional window of actions opens, for example, if the action β€œCancel order” is selected, then an additional window opens with the ability to enter a comment:

Automate HR processes using Microsoft Teams, PowerApps and Power Automate. Employee leave requests

After clicking on the "Confirm" button, the status of the application changes, and this can be done even without starting the Power Automate flow. Let's use the "Patch" function for the "OnSelect" property of the button:

Automate HR processes using Microsoft Teams, PowerApps and Power Automate. Employee leave requests

Using the Patch function, we update an element in the list of requests by filtering it by the ID of the current element. We change the value of the "Status" field and make the transition to the main screen. For other action buttons, the logic is similar.

It remains to configure the approval flow. Let's do it in its simplest form.

Power automat

Our approval flow will be launched automatically when an application is created. During execution, the status of the application will change, the head of the unit will be received and an email notification about the new application will be sent to the head. To determine the head, we have a reference book "Subdivisions":

Automate HR processes using Microsoft Teams, PowerApps and Power Automate. Employee leave requests

Create a Power Automate flow:

Automate HR processes using Microsoft Teams, PowerApps and Power Automate. Employee leave requests

During the execution of this flow, the head of the department receives an email notification about the creation of a new application and can follow the link to make a decision by clicking on the button:

Automate HR processes using Microsoft Teams, PowerApps and Power Automate. Employee leave requests

Clicking the "Approve" or "Reject" button also launches the Power Automate flow, which changes the status of the application and sends an email notification to the HR specialist:

Automate HR processes using Microsoft Teams, PowerApps and Power Automate. Employee leave requests

The process is ready.

teams

And the final touch is the organization of joint work with this process. To do this, we connect the process to the MS Teams team:

Automate HR processes using Microsoft Teams, PowerApps and Power Automate. Employee leave requests

Now, all members of the MS Teams team have access to the process of leaving new employees on a separate tab.

Of course, you can provide multi-step approval in your flow logic, plus you can use the Approvals component to assign Power Automate tasks. You can also set up reports and generate notifications that will be sent to the Microsoft Teams chatbot. But more on that in future articles. Thank you for your attention and have a great day!

Source: habr.com

Add a comment