Work shift automation with AI Builder

Shift work
Many organizations, thanks to the specifics of their business, require their employees to work outside the traditional 9h to 17h – Mon to Fri schedules. Industries like manufacturing, healthcare, hospitality, aviation have at least some departments working in some sort of shift work.
Living myself with a person that works at an airport in a rotation shift (4 days on 2 days off), I am familiar with this scenario. Here’s a few struggles that often those employees experience:
- Working on rotation they frequently don’t know the day of the week
- Sundays are not different from Mondays 😃
- On a daily basis they need to check the time they start working on the next days
How it works
On a monthly basis, employees will receive from management or HR an email with the work shift attached for the next month. The work shift can be an Excel or image file similar to the example below.

Each employee will have a row with different codes to identify the different shifts and days off.
At the end of day, at least at our home, the work shift will end up printed at the fridge door for daily consultation.
The Power Platform Advisor in me
After a few minutes analysing the format of the work shift image, I realized that would be awesome if I could find a way to create calendar entries for each work day in an automated way and for all months of the year.
Looking at the Power Platform stack, the AI Builder and Power Automate looked like the obvious choices to address this challenge. So I immediately started.
AI Builder

I quickly found the custom model Extract custom information from documents from the Documents category.

Chose the document type.

Added the fields Year and Month and a Table.

The format of the Table kept me thinking for a while. Should I go for a column for each day of the month or a single column with all days? After testing the model behavior with the codes, I decided to create a single column that will store all codes. So the table has Name and Schedule columns. More on this later.

Next step, upload at least 5 documents into a collection. This collection will allow me to tag the fields and tables and train the model.
Tagging the documents, the funny part!



Here’s an example of the data collected for the employee Mia Lewis.

After training the model and once the score is good enough, publish the model. It is now ready to use in Power Automate to create the calendar events!
Power Automate
Now there’s the part where I actually get the metadata from the work shift image and start the automation.

Variables Year and Month can be immediately populated by the fields provided by the JSON response.

A Schedule array and a Day Counter were also created. In order to go over all employees in the image, there’s a Apply to each condition (Table entries output) filtered by the name of employee, in this example Mia Lewis.
Remember that I decided to store all schedules in a single field? To separate schedules of the employee, I use the formula below to convert the string codes (separated by spaces) into an array of codes:
split(items('Apply_to_each_table_entry')?['Schedule/value'], ' ')
The Result


My goal was achieved but I wasn’t happy enough with the result therefore I decided to tweak a bit more the automation and tried the same result in Outlook calendar. With the help of the Graph API I managed to set a category for the calendar events.

This Power Automate cloud flow can easily be adapted to run centrally in any organization and automatically add employees’ calendar with their work shift.
Hopefully this article will help convert some of the airport employees into citizen developers, taking themselves advantage of the Power Platform tools at their disposal. Of course, for more complex scenarios they can always ask Forward Forever for support 😃
One response to "Work shift automation with AI Builder"