elastic blog


elastic blog

Use case: leave request process

How to build a simple leave request process using Elastic Forms and Microsoft Flow

Rafał HryniewskiRafał Hryniewski

We’ve recently released our newest application – Elastic Forms. While it’s easy to work with and powerful solution as a standalone application, you can expand its functionalities by order of magnitude using our API with other services. In this post, we’ll follow the example of using Elastic Forms with Microsoft Flow.

This combination gives us access to many built-in integrations out of the box and with ease. Standard scenarios where integrations would require to use API endpoints and manually composing requests which require a certain degree of technical knowledge just to model simple business process. We’ve made it simple and accessible to anyone.


The simplest scenario that exists in probably every company is a leave request and accepting/rejecting it. Doing this manually often requires filling in a form on paper, revision by supervisor or manager and sometimes request is being processed by even more people. With Elastic Forms and Microsoft Flow, everything you’ll need is two forms and model of this process made in MS Flow. Most beautiful part of that is the fact that when a process is modeled you can reuse it in your organization as long as it doesn’t change.

We’ve done a great job with releasing Elastic Forms to the world, so I think I could celebrate it with short vacations. That means I need to create the entire process and make it reusable through our company. Let’s do it together and see how it’s done.

Elastic Forms

I’ve started with creating simple holiday request form in Elastic Forms, that contains some basic info my manager will need to grant me (or not!) some time off. The form is composed of two date fields for my holiday’s duration and one paragraph field for any additional information.

My manager needs a form of his own to review my request so I’ve created one for him. This form is a bit longer and is composed of two sections. First being some information about me and my request, the second one is his decision. This form will be filled automatically with data from holidays request and the user who filled it.

Learn how easily you can create forms, surveys and chat bots using Elastic Forms:

Microsoft Flow

Let’s move to the Microsoft Flow now and start building our processes. First which we’ll need should handle events that will follow filling holiday request form. To model it we should create new flow from the blank template.

The interface is pretty simple. We should start with giving an appropriate name for our flow and select event that will trigger its execution. In our case name is “Holiday Request” and the trigger is block “When form is filled” which is provided with Elastic Forms application. It executes every time when selected form is completed and passes data from it further.

If we’re creating our first flow using Elastic Forms we’ll be prompted for connection data which is the way to authenticate with Elastic Forms application. We need to name our connection and paste our API Key to it. API key could be acquired from User Settings section of Elastic Forms application.

First actions

In Elastic Cloud Solutions, our employee data and hierarchy is stored in Office 365. Microsoft Flow allows us to integrate rapidly with O365 services using one of its actions.

We’ll use two of them. In first we’ll fetch user data of the person who’ll fill in holiday request. To do that we need user principal name or email id used in O365. Our Elastic Forms Trigger returns set of values based on form fields and some constant data like form title, submission date, and username or email of the user that submitted the form. We can use values returned from previous actions and triggers by clicking them in shown window with dynamic content.

The final effect should look just like on the screenshot below. This step in our flow will lookup user in Office 365 and fetch his or hers data.

Let’s add another step using Office 365 blocks. This one will use fetched from O365 user data and will find a manager for the user who filled holiday request form.

Now we have all data we’ll need to assign acceptance form to the manager of the user who submitted a request. Let’s use Elastic Forms “Assign form” block and pass previously acquired values to it. Screenshot below presents filled the block, we’ve passed User Principal name to user field of this block – this means acceptance form will be assigned to the manager of whoever submitted this request. Fields “Name and Last Name”, “Email” and “Phone Number” should be filled with this employee data, they’ll be useful for a manager who’ll review this request. Next fields I’ve filled with data acquired from our trigger and they’ll be used in exact same purpose. I’ve left last two fields empty, those will be filled by my manager.

This block will acquire and pass URL to assigned form which should be reviewed and completed by my manager. That means I need to notify him somehow. I’ll use Outlook to send a simple email message and Twilio for sending SMS to him. Let’s start with e-mail.


We’ll need to use manager e-mail which we’ll acquire from O365 in “To” field and employee’s email in “CC” field. In the body, we’ll need to compose a simple message with some basic HTML formatting.

That’s it! Our email formatting is done.Let’s configure SMS now. Assuming we have Twilio account we could use its block. The first phone number was hard coded because it’s the one Twilio provides in its API, the second one is a number of the previously found manager. The last one is a short message with URL in case manager isn’t in front of the desk and will want to review our request on a cellphone.

Second process

The first process is done now. When any employee will fill in holiday request form Flow will use its built-in integrations to acquire his or her data from O365, then it’ll find manager responsible for this employee. The manager will have the form ready to review along with notification and URL to it on email and mobile phone. What’s left is reviewing and accepting or rejecting the request.

Let’s model second, a similar process for acceptance form. After acceptance will be submitted we should use its fields to find user who reviewed request and send different messages in case request was accepted or rejected to user who filled in request, we have this employee’s phone number and email because we’ve passed them during assigning form in the previous process so we don’t have to look them up in Office 365 again.

Let’s not repeat basics and move straight to condition block. We’re taking “Accept Request” value from acceptance form and check if it’s true or not. Our flow will fork after this condition and on the left side, we’ll have events that should happen when the condition has been fulfilled and on right side event that’ll happen in any other case. Building flow on both sides is exactly the same as we’ve done it previously and that’s how final effect looks like. The only difference is that we’ve used Gmail to send emails now, just to show you yet another simple integration.

So now we have modeled entire process. Since the goal of building it was me going on holidays, I’m supposed to fill in holiday request form which is now embedded in our Elastic Intranet subpage with HR documents. Previously I’ve had to download some template, print it or fill it in the text editor and send to my manager. Now I’m just filling the form with few fields.

My manager received email and SMS message with my request and reviewed it during his business trip. I’ve received the response on my phone in less than ten minutes even though he was away from the office and even laptop at the moment! Sadly my request has been rejected.


Let’s wrap thing up. I’ve modeled this process with ease and it took me about an hour. Thanks to that requesting and granting holidays now don’t require any paperwork from employee and manager and the entire process can be finished in minutes regardless of where we are. We can integrate with other APIs supported in MS Flow in minutes, coding the same integrations and same functionalities into the application would take few times longer and would require deploying new release with this functionalities. Now we can do it without touching code as long as we work with data provided and accepted by blocks available in Microsoft Flow.

I hope you’ve gained some insights about using Elastic Forms and Flow in your own business processes. We’ll cover more scenarios in the near future. Feel free to explore its possibilities before that and if you have any questions about that – just ask 👋

I'm developer at Elastic Cloud Solutions. After hours I'm passionate .NET Dev, blogger and speaker. I love playing with cloud, distributed systems, actor model and databases.

Comments 0
There are currently no comments.