Install and configure the Travel Approval PowerApps sample
Step-by-step instructions for installing and configuring the Travel Approval PowerApps sample.
Estimated time to complete these steps: 25-30 minutes
If you would like to see a demonstration of this process please watch this installation and setup video.
Travel Approval PowerApps sample overview
The Travel Request PowerApp allows company employees to easily submit travel requests from desktop or mobile devices. Travel Requests are automatically routed to the appropriate Manager and Travel Department for approval. This reduces processing time. Managers can also access status reports for all travel requests to verify current status and manage the travel budget.
Watch the Travel Approval Demo Video to see how to use the Travel Approval PowerApp Sample.
Prerequisites
- Sign up for PowerApps.
- A SharePoint Online global administrator account.
- Have a Power BI account and Power BI Desktop installed.
- Clone the project to your local machine.
Create the Travel SharePoint list
This list stores all the travel requests.
Install
-
Download and install the SharePoint Online Management Shell.
-
Open the SharePoint Online Management Shell command prompt. To do so, click the Start button in Windows, type SharePoint, then click SharePoint Online Management Shell.
-
In the SharePoint Online Management Shell command prompt, change to the TravelRequest folder under the project that is cloned in your local environment.
-
Modify the script commands below by replacing the $orgName variable value (replacing all the text between the quotes, including the < and > characters) in the first line of script code, and then run the following commands in the SharePoint Online Management Shell command prompt:
$orgName="<name of your Office 365 organization, example: contoso>" Connect-SPOService -Url https://$orgName-admin.sharepoint.com
-
When prompted by the Microsoft SharePoint Online Management Shell dialog box, enter the account name and password for a SharePoint global administrator account, and then click Sign in.
-
Run following PowerShell script to install the SharePoint Site Script. After running the cmdlet, you get a result that lists the ID of the new Site Script. Copy this ID and save it to a text file, you will need it in subsequent steps.
Get-Content '.\travelApprovalList.json' ` -Raw | ` Add-SPOSiteScript ` -Title "TravelApprovalList"
-
Run the following cmdlet to add a new Site Design. Replace the ID placeholder (replace the ID text, including the < and > characters) with the Site Script ID you saved in the text file.
Add-SPOSiteDesign ` -Title "Travel Approval" ` -WebTemplate "64" ` -SiteScripts "<ID>" ` -Description "Create a site with a list named travel"
-
Open the SharePoint home page, click Create site, then select Team site.
-
Select the Travel Approval template and use the screenshot below for reference to enter values for site name, site description and additional owners. Click Next.
-
Add any additional owners or members, then click Finish button to submit.
-
When the site is created, the web browser will open the new site and display the status in the right panel.
-
Close the status panel on the right, then click the Site contents link in the left menu. Verify the Travel list exists.
-
IMPORTANT Open the Travel list and add at least one record for testing.
Note: If the SharePoint list is empty, Power BI can not publish the report successfully in the next step.
Create a Power BI workspace
-
Open a web browser and go to https://app.powerbi.com.
-
Sign in with an account that has a Power BI Pro license.
-
Click Workspaces.
-
Click Create app workspace.
-
In the Name your workspace textbox, enter Travel Requests.
-
In the Add workspace members textbox enter the email addresses for all the users who will need to access the report.
-
Click Save.
Create a Power BI dashboard
-
Open TravelRequest-Reports.pbix report in the resource folder.
-
Click Edit Queries.
-
Click Data source settings.
-
Click Change Source.. to update to the data source to use the SharePoint site you created in previous steps. Click Close.
Note: Do not include the full path to the SharePoint list.
-
Click Refresh Preview to refresh your changes. You may need to Edit Credentials as shown in the screenshot below. Sign in with your Microsoft account and select the SharePoint list for Travel Approvals then click Connect.
-
Click Close & Apply to apply your changes. Then click the Publish button in the Ribbon and select the workspace you previously created.
-
Open the workspace by going to https://app.powerbi.com
-
Open the existing report and click on Pin Live Page.
-
Select the New dashboard radio button and enter Travel Report in the textbox, then click Pin live.
-
Click the ellipses next to Travel Reports in DATASETS, then click SCHEDULE REFRESH.
-
Click Edit credentials, then select Oauth2.
- In the Scheduled refresh section, turn on the Keep your data update to date toggle, then click Apply.
Create the 'Travel Group Approver' Office 365 Group
-
Open a new PowerShell console as an administrator and run the following command:
Set-ExecutionPolicy RemoteSigned
-
Then run the create-group.ps1 script to create the 'Travel Group Approver' Office 365 group. This script is found in the root directory of the local folder where you cloned the sample. When the cmdlet runs, you will be prompted to login. Login with an account hat is a SharePoint Online global administrator. Copy and save the , values returned by the script.
./create-group.ps1
-
Run the following command:
Set-ExecutionPolicy Default
Get the Travel Request PowerApp
Note: The steps in this article demonstrate how to install and configure the tablet version of the PowerApp. The steps are exactly the same for the mobile version, except for the PowerApp zip file you download and import.
- Get the mobile version TravelRequestMobile-PowerApp.zip under TravelApproval/resource folder in your local project that is cloned in your local environment.
- Get the tablet version TravelRequestPad-PowerApp.zip under TravelApproval/resource folder in your local project that is cloned in your local environment.
Import the Travel Request PowerApp
-
In a web browser, navigate to https://web.powerapps.com.
-
Sign in by providing the same credentials that you used to sign up.
-
In the menu on the left, select Apps.
-
Click Import package(preview).
-
Click the Upload button, then select the PowerApp package you downloaded in previous steps.
-
When the import process completes, verify the IMPORT SETUP value is set to Create as new.
-
Click Import and wait until the process is complete.
Configure the PowerApp
-
In the web browser, click Apps.
-
Click the ellipses next to the Travel Request PowerApp.
-
Click Edit.
-
Click Allow.
Delete existing connection to the Travel list
Connect to Travel request list
-
Click View.
-
Click Data sources.
-
In the Data pane, click Add data source.
-
Select SharePoint.
-
In the Recent sites list, select the SharePoint site where you created the Travel Request List.
Note: If the site does not appear in the list, enter the URL to the SharePoint site in the textbox, then click Go.
-
In the Search textbox at the top of the list enter Travel.
-
Check the checkbox next to the Travel list.
-
Click Connect.
-
Click File.
-
Click Save.
Configure the Power BI report
-
In the Screens pane, select the Reports Screen.
-
Select the existing pbiReport control and edit it's properties.
-
In the Properties pane, click the URL that appears next to the Data label.
-
In the Workspace dropdown, select Travel Requests.
-
In the Dashboard dropdown, select Travel Requests Dashboard.
-
In the Tile dropdown, select Travel Reports.
-
Click File.
-
Click Save.
-
Click Publish.
-
Click Publish this version.
Update travel approval group name
-
Select Main Screen on the left menu, click Action, then click the On Start button. Then, enlarge the input text box.
-
Update the and placeholders with the values the PowerShell returned in the Create Travel Group Approver Group steps.
Note: Make sure you replace the < and > characters in the placeholders.
Save and Publish the app
- Click File on the main menu and click Save to submit the changes.
- Click Publish and Publish this version
##Modify the Flow
Login Microsoft Flow
- In a web browser, navigate to https://flow.microsoft.com
- Sign in with your work account
Create connections
-
In the menu on the left, select Data > Connections.
-
Click +New connection.
-
Add SharePoint connection with Connect directly (cloud-services) settings.
-
Add Approvals connection, Office 365 Outlook and Office 365 Group connections as previously.
Import Flow Template
-
Change to My flows menu on the left.
-
Click Import, click Upload button then pick TravelRequest-Flow.zip.
-
Resolve conflicts for related resources by clicking on Select during import and select click Save
Note: Import failed may be caused by a flow with the same name already in the system. Remove the existing one and import again.
-
Click Import
Modify the Flow
-
In the menu on the left, click My Flows.
-
If prompted to sign in, sign in by providing the same credentials that you used to sign up.
-
Next to the Travel Request Flow, click the pencil icon.
-
Expand the When a new item is created action.
-
Change the Site Address and List Name to match the Travel SharePoint list you created.
Note: You don’t need to type it manually, you can choose it in the dropdown lists.
-
Expand the following 6 actions and change the Site Address and List Name to match the Travel SharePoint list you created.
-
Did manager approve -> If yes -> Update item
-
Did manager approve -> If no -> Update item 5
-
Did manager approve -> If yes -> Did travel dept. approve -> If yes -> Update item 2
-
Did manager approve -> If yes -> Did travel dept. approve -> If no -> Update item 3
-
Get item
-
Is there no manager response -> if yes -> Get item 2
-
Click Save.
Note: Make sure form creator (Travel Requestor) has manager that is configured in AAD and Travel Department Group has member in it. Then the Flow will work normally.
Play the PowerApp
-
In the web browser, click Apps.
-
Click the ellipses next to the Travel Request Mobile PowerApp.
-
Click Play.
Watch the Travel Approval Demo Video to see how to use the Travel Approval PowerApp Sample.