Build an Overtime Timesheet App in Power Apps — Part 18: Build a Setup Flow That Creates the Lists
The Overtime Timesheet app needs three SharePoint lists and a library, set up exactly as Part 2 made them by hand. This part builds one flow that creates all of them on any site, with every column, setting and starting item, and that can run again without creating anything twice.
This is Part 18 of a 22-part series.
- Part 1: Plan the App and Set Up the Demo Organization
- Part 2: Create the SharePoint Site and Lists
- Part 3: Keep Overtime Private with SharePoint Permissions
- Part 4: Create the Solution, Environment Variables and Canvas App
- Part 5: Build the Home Screen
- Part 6: Build the Log Overtime Screen
- Part 7: Build the My Overtime Screen
- Part 8: Build the Approval Flow for Teams and Outlook
- Part 9: Show Approvers What's Waiting
- Part 10: Build the Departments Screen
- Part 11: Build the Reports Screen
- Part 12: Import the Old Excel Timesheet
- Part 13: Create the Monthly Payroll Workbook with Office Scripts
- Part 14: Create the Payroll Workbook from the App
- Part 15: Build the Power BI Overtime Report
- Part 16: Share the App and Add It to Microsoft Teams
- Part 17: Manage Joiners, Movers and Leavers
- Part 18: Build a Setup Flow That Creates the Lists (you are here)
- Part 19: Set SharePoint Permissions from the Setup Flow (coming soon)
- Part 20: Run the Solution Checker and Export the Solutions (coming soon)
- Part 21: Install the App in a New Environment (coming soon)
- Part 22: Recap, Production Checklist and Next Steps (coming soon)
Everything the app reads and writes lives on one SharePoint site: Departments, OvertimeEntries, Settings and the Payroll Exports library. Part 2 created them by hand, column by column. Anyone installing the app on another site would have to repeat every one of those clicks, and a single typo in an internal name breaks the app. This part turns that work into a flow, Set Up Overtime Timesheet, in a solution of its own. Part 19 adds the permissions from Part 3 to the same flow.
What You'll Build
The flow's steps, in order:
- Manually trigger a flow, with three inputs: the site's address and the Object IDs of the payroll and admins groups.
- List definitions (Compose): the three lists and the library, with their columns and settings, as JSON.
- Check the site: stops the run if the address is wrong.
- For each list (Apply to each):
- Find the list, then If the list is missing, with Create the list in its True branch.
- If Title should be hidden: make the Title column optional, hide it in the forms and take it out of the view.
- If Title should be unique: make Title unique.
- For each column: Find the column, then If the column is missing, with Create the column.
- Update the list settings: description, attachments, versions, navigation, search and validation.
- Settings items (Compose) and For each setting: add the two group IDs to the Settings list, when they're missing.
- Find the Setup folder, then If the Setup folder is missing, with Create the Setup folder in the library.
The finished flow, with the three loops collapsed:

How It Works
- The lists are data. One JSON array describes every list: its name, address, settings and columns. Every later step reads from it, so the lists are described in one place, and adding a column means adding one entry.
- Every step looks before it creates. A list, a column, a settings item or a folder is created only when it's missing. A second run finds everything in place.
- One solution of its own. The flow runs before the app is installed: the app's environment variables point at lists, and the lists have to exist first. So the flow lives in a second solution, Overtime Timesheet Setup, with its own SharePoint connection reference.
- REST requests, standard licences. Every SharePoint step is Send an HTTP request to SharePoint, from the standard SharePoint connector (How to Use Send an HTTP Request to SharePoint). Microsoft 365 licences include cloud flows with standard connectors (Power Automate seeded licenses), so it costs nothing extra.
- What stays manual. Creating the site itself, and its regional settings: the locale and time zone belong to the organization installing the app, so they're set by hand in Step 1. The permissions come in Part 19.
Prerequisites
- Part 17 completed.
- Permission to create a SharePoint site, for the test site.
Step 1: Create an Empty Test Site
Test the flow on a site of its own, never on the app's site from Part 2: the flow creates and changes lists, and an empty site is exactly what a new installation starts from. On the SharePoint start page, I selected Build, then Site under Start building (How to Create a SharePoint Communication Site).
The template window opened with names such as TemplateSelectionTitle where its labels should be. Closing it and reloading the page brought the labels back (Fixed: SharePoint Shows TemplateSelectionTitle Instead of Select a Site Template). Then Communication site, the Blank template, now the first of twelve, and Use template:
| Setting | Value |
|---|---|
| Site name | Overtime Timesheet Test |
| Site description | Test site for the Overtime Timesheet setup flow. |
| Site address | /sites/OvertimeTimesheetTest |
| Language | English |

The new site came up with Pacific Time and the English (United States) locale, as every new site here does. I set it like the app's site, under Site settings > Regional settings:
- Locale: English (United Kingdom). The page reloaded with Monday as the first day of the week and the 24-hour clock (How to Change the Date Format of a SharePoint Site, How to Show Times in 24-Hour Format in SharePoint).
- Time zone: (UTC) Dublin, Edinburgh, Lisbon, London (How to Change the Time Zone of a SharePoint Site).
Its Site contents had only what SharePoint creates with every site:

Step 2: Create the Setup Solution
In Power Apps, on Solutions, select New solution (How to Create a Solution and Publisher in Power Apps):
| Field | Value |
|---|---|
| Display name | Overtime Timesheet Setup |
| Name | OvertimeTimesheetSetup |
| Publisher | Dewiride (Dewiride), from Part 4 |
| Version | 0.1.0.0 |
| Set as your preferred solution | Ticked |
| Description (under More options) | Creates the SharePoint lists and library that the Overtime Timesheet app needs, on any site. Run its flow once, before you install the app. |
The Publisher drop-down opened only when I selected its arrow.

Set as your preferred solution matters: new flows go into the preferred solution, and with the app's solution still preferred, the flow would land there too (Fixed: A New Cloud Flow Shows Up in Two Solutions in Power Automate).
Step 3: Create the Connection Reference
In the new solution, select New > More > Connection Reference (How to Create a Connection Reference in a Solution in Power Apps):
| Field | Value |
|---|---|
| Display name | Overtime Timesheet Setup SharePoint |
| Name | dewiride_OvertimeTimesheetSetupSharePoint |
| Description | SharePoint connection for the flow that sets up the Overtime Timesheet lists and library on a site. |
| Connector | SharePoint |
| Connection | Your SharePoint connection, chosen for you |

Every SharePoint step in the flow connects through it. Whoever imports the solution later picks their own connection for it.
Step 4: Create the Flow and Its Inputs
In the solution, select New > Automation > Cloud flow > Instant (How to Create an Instant Cloud Flow in a Solution in Power Automate). Name it Set Up Overtime Timesheet, choose Manually trigger a flow, and select Create:

The trigger takes three Text inputs (How to Add a Text Input to a Manually Triggered Flow in Power Automate):
| Input | Description | In expressions |
|---|---|---|
| Site URL | The address of the SharePoint site, such as https://contoso.sharepoint.com/sites/OvertimeTimesheet | triggerBody()?['text'] |
| Payroll group ID | The Object ID of your payroll group in Microsoft Entra, such as Overtime Payroll | triggerBody()?['text_1'] |
| Admins group ID | The Object ID of your app admins group in Microsoft Entra, such as Overtime Admins | triggerBody()?['text_2'] |

The two group IDs end up in the Settings list, where the app looks for them (Part 5).
Created from the solution in Power Apps, the flow opened in the classic designer. I added the inputs and the next step there and saved. For the rest, I opened the flow from Power Automate's Solutions page: the solution, then the flow, then Edit. It opened in the new designer.
Step 5: Describe the Lists in List Definitions
Under the trigger, add a Compose and rename it List definitions (How to Use the Compose Action in Power Automate). Its input is a JSON array with one object per list:
| Property | What it holds |
|---|---|
title | The list's name |
url | Its address on the site: Lists/<name> for a list, the bare name for a library |
template | 100 for a list, 101 for a document library |
description | The list's description |
onQuickLaunch | true to show it in the site's navigation |
noCrawl | true to keep it out of search results |
versionLimit | How many versions of each item to keep |
validationFormula, validationMessage | The list's validation rule, or empty |
hideTitle | true to hide the Title column, as Part 2 did for Departments and OvertimeEntries |
uniqueTitle | true to make Title unique, as for the Settings list's setting names |
columns | One entry per column: name, its internal name, and schemaXml, its definition |
Here's the Settings list, the shortest:

{
"title": "Settings",
"url": "Lists/Settings",
"template": 100,
"description": "Settings for the Overtime Timesheet app, such as the IDs of the payroll and admins groups. Only site owners can change them.",
"onQuickLaunch": false,
"noCrawl": false,
"versionLimit": 50,
"validationFormula": "",
"validationMessage": "",
"hideTitle": false,
"uniqueTitle": true,
"columns": [
{
"name": "Value",
"schemaXml": "<Field Type='Text' Name='Value' StaticName='Value' DisplayName='Value' Description='The setting's value, such as the Object ID of a Microsoft Entra group.' Required='TRUE' MaxLength='255' />"
}
]
}
Each schemaXml is a column's Field element, the XML SharePoint uses to define a column. It uses single quotes, because it sits inside a JSON string, and ' for an apostrophe. Part 2's columns needed these kinds, each with a guide of its own:
| Column | What its XML needs | Guide |
|---|---|---|
| Department in Departments | Indexed='TRUE' EnforceUniqueValues='TRUE' | Unique values with the REST API |
| Approvers | Type='UserMulti', Mult='TRUE', UserSelectionMode='PeopleOnly' | A person column with the REST API |
| BreakMinutes, Hours | Min, Max and Decimals | A number range with the REST API |
| WorkDate | Format='DateOnly' | A date-only column with the REST API |
| Status | Type='Choice' with CHOICES and a Default | CreateFieldAsXml |
To copy a column's definition from a list that already has it, read its SchemaXml in the browser (How to See a SharePoint Column's Internal Name and SchemaXml in the Browser). OvertimeEntries also carries Part 2's validation rule. In JSON, its validationFormula is =AND(EndTime>StartTime,EndTime-StartTime<=1,BreakMinutes<(EndTime-StartTime)*1440).
The complete input, pasted into List definitions → Inputs:
[
{
"title": "Departments",
"url": "Lists/Departments",
"template": 100,
"description": "Departments and their overtime approvers. Used by the Overtime Timesheet app.",
"onQuickLaunch": true,
"noCrawl": false,
"versionLimit": 50,
"validationFormula": "",
"validationMessage": "",
"hideTitle": true,
"uniqueTitle": false,
"columns": [
{
"name": "Department",
"schemaXml": "<Field Type='Text' Name='Department' StaticName='Department' DisplayName='Department' Description='The department's name, such as Radiology. Each department can appear only once.' Required='TRUE' MaxLength='255' Indexed='TRUE' EnforceUniqueValues='TRUE' />"
},
{
"name": "Approvers",
"schemaXml": "<Field Type='UserMulti' Name='Approvers' StaticName='Approvers' DisplayName='Approvers' Description='The people who approve overtime for this department.' Required='TRUE' List='UserInfo' Mult='TRUE' UserSelectionMode='PeopleOnly' UserSelectionScope='0' />"
},
{
"name": "IsActive",
"schemaXml": "<Field Type='Boolean' Name='IsActive' StaticName='IsActive' DisplayName='IsActive' Description='Yes: staff can choose this department. No: retired, and kept for history.' Required='TRUE'><Default>1</Default></Field>"
}
]
},
{
"title": "OvertimeEntries",
"url": "Lists/OvertimeEntries",
"template": 100,
"description": "Overtime entries: one item per shift worked. Written by the Overtime Timesheet app.",
"onQuickLaunch": true,
"noCrawl": true,
"versionLimit": 50,
"validationFormula": "=AND(EndTime>StartTime,EndTime-StartTime<=1,BreakMinutes<(EndTime-StartTime)*1440)",
"validationMessage": "The finish must be after the start and no more than 24 hours later, and the break must be shorter than the shift.",
"hideTitle": true,
"uniqueTitle": false,
"columns": [
{
"name": "WorkDate",
"schemaXml": "<Field Type='DateTime' Name='WorkDate' StaticName='WorkDate' DisplayName='WorkDate' Description='The day the shift started.' Required='TRUE' Format='DateOnly' FriendlyDisplayFormat='Disabled' />"
},
{
"name": "StartTime",
"schemaXml": "<Field Type='DateTime' Name='StartTime' StaticName='StartTime' DisplayName='StartTime' Description='When the shift started.' Required='TRUE' Format='DateTime' FriendlyDisplayFormat='Disabled' />"
},
{
"name": "EndTime",
"schemaXml": "<Field Type='DateTime' Name='EndTime' StaticName='EndTime' DisplayName='EndTime' Description='When the shift finished. Can be the next day for a night shift.' Required='TRUE' Format='DateTime' FriendlyDisplayFormat='Disabled' />"
},
{
"name": "BreakMinutes",
"schemaXml": "<Field Type='Number' Name='BreakMinutes' StaticName='BreakMinutes' DisplayName='BreakMinutes' Description='The unpaid break during the shift, in minutes.' Required='TRUE' Decimals='0' Min='0'><Default>0</Default></Field>"
},
{
"name": "Hours",
"schemaXml": "<Field Type='Number' Name='Hours' StaticName='Hours' DisplayName='Hours' Description='Hours worked: the time from start to finish, minus the break. Worked out by the app.' Required='TRUE' Decimals='2' Min='0' Max='24' />"
},
{
"name": "DepartmentId",
"schemaXml": "<Field Type='Number' Name='DepartmentId' StaticName='DepartmentId' DisplayName='DepartmentId' Description='The ID of the department's item in the Departments list.' Required='TRUE' Decimals='0' CommaSeparator='FALSE' />"
},
{
"name": "Department",
"schemaXml": "<Field Type='Text' Name='Department' StaticName='Department' DisplayName='Department' Description='The department's name when the entry was saved.' Required='TRUE' MaxLength='255' />"
},
{
"name": "Reason",
"schemaXml": "<Field Type='Note' Name='Reason' StaticName='Reason' DisplayName='Reason' Description='Why the overtime was needed.' Required='TRUE' RichText='FALSE' />"
},
{
"name": "EmployeeName",
"schemaXml": "<Field Type='Text' Name='EmployeeName' StaticName='EmployeeName' DisplayName='EmployeeName' Description='The name of the person who worked the shift, when the entry was saved.' Required='TRUE' MaxLength='255' />"
},
{
"name": "EmployeeEmail",
"schemaXml": "<Field Type='Text' Name='EmployeeEmail' StaticName='EmployeeEmail' DisplayName='EmployeeEmail' Description='Their email address when the entry was saved. Empty only for imported entries of people who have left.' MaxLength='255' Indexed='TRUE' />"
},
{
"name": "Status",
"schemaXml": "<Field Type='Choice' Name='Status' StaticName='Status' DisplayName='Status' Description='Pending until an approver approves or rejects the entry. Set by the approval flow.' Required='TRUE' Format='Dropdown' FillInChoice='FALSE' Indexed='TRUE'><CHOICES><CHOICE>Pending</CHOICE><CHOICE>Approved</CHOICE><CHOICE>Rejected</CHOICE></CHOICES><Default>Pending</Default></Field>"
},
{
"name": "ApproverComment",
"schemaXml": "<Field Type='Note' Name='ApproverComment' StaticName='ApproverComment' DisplayName='ApproverComment' Description='The approver's comment, if they gave one.' RichText='FALSE' />"
},
{
"name": "DecisionBy",
"schemaXml": "<Field Type='Text' Name='DecisionBy' StaticName='DecisionBy' DisplayName='DecisionBy' Description='The name of the approver who approved or rejected the entry.' MaxLength='255' />"
},
{
"name": "DecisionOn",
"schemaXml": "<Field Type='DateTime' Name='DecisionOn' StaticName='DecisionOn' DisplayName='DecisionOn' Description='When the entry was approved or rejected.' Format='DateTime' FriendlyDisplayFormat='Disabled' />"
},
{
"name": "WorkMonth",
"schemaXml": "<Field Type='Text' Name='WorkMonth' StaticName='WorkMonth' DisplayName='WorkMonth' Description='The month the shift started in, as year and month, such as 2026-11. The app and flows filter on it.' Required='TRUE' MaxLength='255' Indexed='TRUE' />"
}
]
},
{
"title": "Settings",
"url": "Lists/Settings",
"template": 100,
"description": "Settings for the Overtime Timesheet app, such as the IDs of the payroll and admins groups. Only site owners can change them.",
"onQuickLaunch": false,
"noCrawl": false,
"versionLimit": 50,
"validationFormula": "",
"validationMessage": "",
"hideTitle": false,
"uniqueTitle": true,
"columns": [
{
"name": "Value",
"schemaXml": "<Field Type='Text' Name='Value' StaticName='Value' DisplayName='Value' Description='The setting's value, such as the Object ID of a Microsoft Entra group.' Required='TRUE' MaxLength='255' />"
}
]
},
{
"title": "Payroll Exports",
"url": "PayrollExports",
"template": 101,
"description": "Monthly overtime workbooks for payroll. Created by the Overtime Timesheet app.",
"onQuickLaunch": false,
"noCrawl": false,
"versionLimit": 500,
"validationFormula": "",
"validationMessage": "",
"hideTitle": false,
"uniqueTitle": false,
"columns": []
}
]

Step 6: Check the Site
Every SharePoint step in the flow uses the trigger's Site URL as its Site Address (Enter custom value, then the Site URL token). The first one, Check the site, asks the site for its title and its address on the server:
| Field | Value |
|---|---|
| Site Address | Site URL |
| Method | GET |
| Uri | _api/web?$select=Title,ServerRelativeUrl |
| Headers | Accept: application/json;odata=nometadata |

If the address is wrong, this request fails, and the steps after it don't run, so nothing is created on a site nobody meant. Its answer's ServerRelativeUrl, here /sites/OvertimeTimesheetTest, is used again in Step 11.
The first SharePoint action I added picked another solution's SharePoint connection reference instead of this solution's, and so did every new one after it. I switched each to Overtime Timesheet Setup SharePoint with Change connection reference (How to Change an Action's Connection Reference in Power Automate, Fixed: A Flow in a Solution Uses Another Solution's Connection Reference in Power Automate).
Step 7: Create Each List Only When It's Missing
Add an Apply to each, For each list, over the Outputs of List definitions (How to Loop Through an Array with Apply to Each in Power Automate):

Inside it, every value of the current list comes from items() (How to Use the items() Function in Power Automate), such as items('For_each_list')?['title']. After a reload, the designer shows these as tokens named after the property, such as title.
Find the list looks for a list with that title (How to Check If a SharePoint List Exists in Power Automate):
_api/web/lists?$filter=Title eq '@{items('For_each_list')?['title']}'&$select=Id

If the list is missing is a condition (How to Add a Condition in Power Automate) that compares this expression with true (How to Check If an Array Is Empty in Power Automate):
empty(body('Find_the_list')?['value'])

The empty second row is the designer's spare row: the condition's Code view shows only the one comparison.
In its True branch, Create the list sends the list's title, address and template to _api/web/lists/add (How to Create a SharePoint Document Library with the REST API in Power Automate). The same request makes both the lists and the library, and gives each the address from its definition:
| Field | Value |
|---|---|
| Method | POST |
| Uri | _api/web/lists/add |
| Headers | Accept: application/json;odata=nometadata |
Content-Type: application/json;odata=verbose |
{
"parameters": {
"__metadata": { "type": "SP.ListCreationInformation" },
"Title": "@{items('For_each_list')?['title']}",
"Url": "@{items('For_each_list')?['url']}",
"TemplateType": @{items('For_each_list')?['template']}
}
}

TemplateType has no quotes, because the template is a number.
Step 8: Hide or Protect the Title Column
Every list starts with a Title column, and the definitions say what to do with it.
If Title should be hidden compares items('For_each_list')?['hideTitle'] with true. Departments and OvertimeEntries don't use Title, so its True branch does what Part 2 did by hand (How to Hide the Title Column of a SharePoint List with the REST API). Every Uri starts with the current list:
_api/web/lists/getbytitle('@{items('For_each_list')?['title']}')
| Action | Method | The Uri goes on with |
|---|---|---|
| Make Title optional | POST, as a MERGE | /fields/getbyinternalnameortitle('Title') |
| Hide Title in new forms | POST | /fields/getbyinternalnameortitle('Title')/setshowinnewform(false) |
| Hide Title in edit forms | POST | /fields/getbyinternalnameortitle('Title')/setshowineditform(false) |
| Hide Title in display forms | POST | /fields/getbyinternalnameortitle('Title')/setshowindisplayform(false) |
| Find Title in the view | GET | /defaultview/viewfields |
| Remove Title from the view | POST | /defaultview/viewfields/removeviewfield('LinkTitle') |
Make Title optional has the headers IF-MATCH: * and X-HTTP-Method: MERGE, and the body { "__metadata": { "type": "SP.Field" }, "Required": false }:

Remove Title from the view sits in the True branch of If Title is in the view, which compares this with true:
contains(body('Find_Title_in_the_view')?['Items'], 'LinkTitle')
On a second run, LinkTitle is no longer in the view, and removing it again would fail (Fixed: "Invalid Field Name" BadGateway When Removing a Column from a SharePoint View). The check keeps the step from running then (How to Check If an Array Contains a Value in Power Automate).
If Title should be unique compares items('For_each_list')?['uniqueTitle'] with true. In the Settings list, Title holds each setting's name, such as PayrollGroupId, so it stays, and it must be unique. Make Title unique is a MERGE on the same column with Indexed and EnforceUniqueValues (How to Enforce Unique Values in a SharePoint Column with the REST API in Power Automate):

Step 9: Add the Columns
Still inside For each list, add For each column, an Apply to each over the current list's columns:
items('For_each_list')?['columns']
Inside it, the same pattern (How to Add a Column to a SharePoint List with CreateFieldAsXml in Power Automate):
- Find the column: a GET to
_api/web/lists/getbytitle('@{items('For_each_list')?['title']}')/fields?$filter=InternalName eq '@{items('For_each_column')?['name']}'&$select=InternalName. - If the column is missing:
empty(body('Find_the_column')?['value'])is equal totrue. - Create the column, in its True branch: a POST of the column's XML to
createfieldasxml.
{
"parameters": {
"__metadata": { "type": "SP.XmlSchemaFieldCreationInformation" },
"SchemaXml": "@{items('For_each_column')?['schemaXml']}",
"Options": 25
}
}

Options 25 keeps the internal names from the XML and puts each column in the forms and the default view. The library has no columns of its own, so for Payroll Exports the loop runs no times at all.
Step 10: Apply the List Settings
The last step in For each list, after For each column, is Update the list settings: a MERGE on the list itself (How to Change SharePoint List Settings with the REST API in Power Automate):
| Field | Value |
|---|---|
| Method | POST |
| Uri | _api/web/lists/getbytitle('@{items('For_each_list')?['title']}') |
| Headers | Accept, Content-Type, IF-MATCH: * and X-HTTP-Method: MERGE |
{
"__metadata": { "type": "SP.List" },
"Description": "@{items('For_each_list')?['description']}",
"EnableAttachments": false,
"EnableVersioning": true,
"MajorVersionLimit": @{items('For_each_list')?['versionLimit']},
"OnQuickLaunch": @{if(items('For_each_list')?['onQuickLaunch'], 'true', 'false')},
"NoCrawl": @{if(items('For_each_list')?['noCrawl'], 'true', 'false')},
"ValidationFormula": "@{items('For_each_list')?['validationFormula']}",
"ValidationMessage": "@{items('For_each_list')?['validationMessage']}"
}

- The two
if()expressions turn a true-or-false value into the texttrueorfalse(How to Use the if() Function in Power Automate). Inserted straight into the body, the values would come out as True or False, which isn't valid JSON (Fixed: "Invalid JSON. A Token Was Not Recognized in the JSON Content"). - The validation comes last on purpose. The formula names columns, and they have to exist first (How to Add List Validation to a SharePoint List with the REST API in Power Automate). For lists without a rule, it sets empty text.
- Attachments go off for every list. The app never attaches files to items.
This step runs on every run: it doesn't create anything, it sets the same values again.
Step 11: Add the Settings Items and the Setup Folder
After For each list, at the top level of the flow, add a Compose called Settings items. It pairs each setting's name with the value typed at the start:
[
{
"title": "PayrollGroupId",
"value": "@{triggerBody()?['text_1']}"
},
{
"title": "AdminsGroupId",
"value": "@{triggerBody()?['text_2']}"
}
]

The names are the ones the app reads in Part 5 (How to Store App Settings in a SharePoint List for Power Apps).
Then For each setting, over outputs('Settings_items'), with the pattern from How to Add an Item to a SharePoint List with the REST API in Power Automate:
- Find the setting: a GET to
_api/web/lists/getbytitle('Settings')/items?$filter=Title eq '@{items('For_each_setting')?['title']}'&$select=Id. - If the setting is missing:
empty(body('Find_the_setting')?['value'])is equal totrue. - Add the setting, in its True branch: a POST to
_api/web/lists/getbytitle('Settings')/items.
{
"__metadata": { "type": "SP.Data.SettingsListItem" },
"Title": "@{items('For_each_setting')?['title']}",
"Value": "@{items('For_each_setting')?['value']}"
}

The item type is written out here, SP.Data.SettingsListItem, because this flow always creates the list at Lists/Settings. I read it from the app's own Settings list first, with the request in the guide, and the POST to the test site's list succeeded with it.
Last comes the library's Setup folder, where Part 13 keeps the payroll workbook's template (How to Create a Folder in a SharePoint Library with the REST API in Power Automate):
- Find the Setup folder: a GET to
_api/web/lists/getbytitle('Payroll Exports')/rootfolder/folders?$filter=Name eq 'Setup'&$select=Name. - If the Setup folder is missing:
empty(body('Find_the_Setup_folder')?['value'])is equal totrue. - Create the Setup folder, in its True branch: a POST to
_api/web/folders, with the folder's address built from Check the site's answer.
{
"__metadata": { "type": "SP.Folder" },
"ServerRelativeUrl": "@{body('Check_the_site')?['ServerRelativeUrl']}/PayrollExports/Setup"
}

Step 12: Run It on the Empty Test Site
In a solution, the new designer saves a draft with Save draft, and its Test asks to Publish & Test, so testing publishes the flow (How to Save a Draft and Publish a Flow in Power Automate). The run panel listed the flow's SharePoint connection reference under Sign in. I selected Continue, typed the test site's address in Site URL, and selected Run flow (How to Test a Cloud Flow Manually in Power Automate). The panel then said No additional information is needed for this step and Not connected., which doesn't mean the run failed (Fixed: "No Additional Information Is Needed for This Step" and "Not Connected").
I built the flow in three stages and ran it after each:
| Run (UK time) | What the flow had | Took | What it did |
|---|---|---|---|
| 06:22 | Steps 5 to 7 | 5 s | Created the three lists and the library |
| 06:48 | Steps 8 to 10 as well | 16 s | Hid or protected Title, added the 19 columns, applied the settings |
| 07:03 | Everything | 16 s | Added the two settings items and the Setup folder |
Nothing read the group IDs until the last stage, so the first two runs got a placeholder, not-used-yet, in both boxes. For the third run, I copied each group's Object ID in Microsoft Entra with Copy object ID to clipboard (How to Find a Group's Object ID in Microsoft Entra) and pasted it into the run form.
The test site's Site contents now has the three lists and the library, and Departments and OvertimeEntries are in the site's navigation:

Departments → New shows its three columns with their descriptions, Title gone, and IsActive ticked by default. I closed the form without saving:

OvertimeEntries → List settings → Validation settings has the rule and its message. SharePoint shows the formula without the square brackets that Part 2 typed, the way it came from the flow. I left the page with Cancel:

The Settings list has the two items. The values in the picture are hidden; they're the same two IDs as in the app's own Settings list:

And Payroll Exports has its Setup folder:

Step 13: Run It Again
A setup flow has to survive being run twice, because someone will run it twice. I repeated the 07:03 run with Test > Automatically > With a recently used trigger, which reuses that run's inputs (How to Rerun a Cloud Flow with the Same Inputs in Power Automate). The newest run in that list still said Test Running, although it had finished; I selected it anyway, and the repeat used its inputs.
Every check found what the first runs had made. Create the list was skipped for each list:

So were Add the setting and Create the Setup folder:

Afterwards, the site had the same lists, columns, items and folders as before: 3 columns in Departments, 15 in OvertimeEntries, 1 in Settings, two settings items and one Setup folder. The flow's run history shows all four runs:

Step 14: Compare with the Lists from Part 2
I compared the test site's lists with the app's own lists, list setting by list setting and column by column, through the REST API:
| What | Result |
|---|---|
| Departments and Payroll Exports | The same |
| Every column of every list | The same type, required setting, index, uniqueness, minimum and maximum, default and decimals; Approvers takes people only on both |
| OvertimeEntries | The same, except for content approval and read and edit only their own items, plus the approval status column in the view: Part 3's settings, which Part 19 adds |
| Settings | The same, except that the app's own list still allows attachments; the flow turns them off, because nothing attaches files to settings |
The flow reproduces everything Part 2 built. The site's permissions are next.
The Problems I Hit
- The site template window showed names instead of labels, such as TemplateSelectionTitle. Closing it and reloading the page fixed it (Fixed: SharePoint Shows TemplateSelectionTitle Instead of Select a Site Template).
- Every new SharePoint action picked another solution's connection reference. I changed each one, as in Step 6.
- The run panel said Not connected. after a run had started. The run itself was fine.
- The repeat's run list said Test Running for a finished run. Selecting it still repeated its inputs.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
| Testing on the app's real site | The flow changes the real lists' settings | Test on an empty site of its own |
| Leaving the app's solution as the preferred one | The new flow is added to both solutions | Tick Set as your preferred solution for the setup solution |
| Keeping another solution's connection reference on an action | The solution depends on a reference it doesn't include | Change each action to this solution's reference |
| Inserting a true-or-false value straight into a JSON body | True or False isn't valid JSON | Use if(…, 'true', 'false') |
| Setting the validation before the columns exist | The formula names columns that aren't there | Apply the settings after For each column |
Changing a column's Name in schemaXml | The app looks for the internal name it was built with | Keep each Name exactly as in the definitions |
| Creating without looking first | A second run fails or makes duplicates | Find, then create only when missing |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Check the site fails | The Site URL is wrong, or the connection's account can't open the site | Copy the address from the browser and check the account's access |
| Create the list fails with 403 | The account can't create lists on the site | Make it a site owner, or use another connection |
| Create the column fails | An apostrophe or a quote in schemaXml isn't escaped | Use ' and single quotes |
| Update the list settings fails with an invalid JSON message | A true-or-false value went in without if() | Wrap it in if(…, 'true', 'false') |
| Remove Title from the view fails on a rerun | The check before it is missing | Keep If Title is in the view |
| The app doesn't see the groups | The settings items have other names | Keep PayrollGroupId and AdminsGroupId |
FAQ
Can I run it on the site from Part 2?
It's built for an empty site, and I ran it only on the test site. On the Part 2 site, every check would find its list, column, item or folder and skip it. Update the list settings would still run, and it would turn off attachments on that site's Settings list.
Does it add any data?
Only the two settings items, the group IDs typed at the start. Departments and OvertimeEntries start empty. The Setup folder starts empty too; the payroll template from Part 13 goes into it when you install the app.
How do I add a column later?
Add an entry to the list's columns in List definitions and run the flow again. The new column is created, every other check finds its work already done, and the list settings are set again to the same values.
How long does it take?
Five seconds for the lists alone on the first run, and 16 seconds for the whole flow, on the test site.
Why doesn't it set the regional settings too?
The locale and time zone belong to the organization installing the app, not to the app. They're three choices on one page, set by hand in Step 1.
Conclusion
The Set Up Overtime Timesheet flow, in its own Overtime Timesheet Setup solution, now creates everything the app needs on a SharePoint site:
- the Departments, OvertimeEntries and Settings lists and the Payroll Exports library, at the addresses the app expects;
- every column, from one JSON description, with its type, rules and description;
- each list's settings, including the hidden Title, versions, navigation, search and validation;
- the two group IDs in Settings, and the Setup folder in the library.
Each step looks before it creates, so a second run changes nothing. Part 19 adds Part 3's permissions to the same flow: the permission level, the groups, unique permissions, item-level permissions and content approval.
Additional Resources
- Working with lists and list items with REST
- Working with folders and files with REST
- Field element (List)
- Test cloud flows
← Previous: Part 17: Manage Joiners, Movers and Leavers Next → Part 19: Set SharePoint Permissions from the Setup Flow (coming soon)
