Using PowerApps and Flow with Dynamics 365 for Finance and Operations, Part 1

With PowerApps and Flow we have a very strong toolbox that allows us to augment standard Dynamics 365 for Finance and Operations (D365FO) features and provide “last-mile” solutions. In this two-part series I explore how we can use PowerApps to augment standard functionality and Flow to provide sophisticated data processing capabilities.

The Scenario

In the following example I am trying to support the following scenario:

The company is keeping track of what equipment is on loan to employees through the Loaned equipment function in the Human resources module. An employee can open a PowerApp and scan the bar code on the equipment to start a new loan. This will close the existing loan record and create a new loan record. In addition, the HR-administrator is informed about the loan through an e-mail.

The following screenshot shows the screen in my PowerApp where the user can scan the bar code.

PowerApps 1.PNG

Data Flow

To support the above scenario I need data to flow from the PowerApp via Flow to D365FO. The data flow is described in the following steps:

  1. The PowerApp invokes a flow and sends parameter-data to the flow.
  2. The data is stored in a SharePoint list (optional step).
  3. This flow also updates any existing equipment loan record in D365FO.
  4. A second flow is triggered when a new item is created in the SharePoint list. The flow sends an e-mail to the HR-administrator informing of the loan with a link to the item in the SharePoint list and subsequently creates a new equipment loan record in D365FO.

In this part of the series I will look at points one and two. In the next part we will be looking at points three and four.

Invoking a Flow from the PowerApp

The first thing we need to do is to invoke a Flow from the PowerApp to get the process going. However, before I go into PowerApps to configure this, I need to set up the Flow to make it available to PowerApps. To make a Flow available in PowerApps, the first step in the Flow needs to be a PowerApps-trigger as shown in the below example.

PowerApps 2

Next step is to determine what data (parameters) I need pass from PowerApps to drive my Flow. As the following screenshot shows, I need Barcode, Purpose, UserId, FromDate and ToDate as data from the PowerApp.

PowerApps 3

This data is used to create the SharePoint item. When linking a parameter in PowerApp to a field in the Sharepoint list, I need to use the Dynamics content provider called “Ask in PowerApps”. This connects the PowerApp-parameter with the SharePoint list field when the Flow is called.

PowerApps 4.PNG

To invoke a flow from PowerApps you need to use the OnSelect method on a control (in my case the control is called “Icon5”. On the Action pane in the ribbon, use the Flows button to link the control to a flow.

As shown in the following screenshot, this brings up a dialogue that allows me to select between the flows available in my organisation.

PowerApps 5.PNG

In this case, I have selected the flow called “PowerApp->Createitem”. This immediately posts the following code into the OnSelect method on the Icon5 control:


PowerApps is now linked to the Flow and I must fill in the parameters, I have requested in the Flow. This results in the following OnSelect method code:

‘PowerApp->Createitem’.Run(Label3.Text;TextInput2.Text;Gallery1_1.Selected.’Partid’; DatePicker1.SelectedDate;DatePicker1_2.SelectedDate)

When clicking on the Icon5 control in the PowerApp, the Flow will now be invoked with the data defined in the parameter-string.

Updating a Record in D365FO

As mentioned above, all I need to do now is to update existing open equipment loan records in D365FO. This is due to a business rule on the LoanedEquipments data entity that does not allow new loans if a loan exists without a returned date.

To do this, I use the Flow connector called “Dynamics 365 for Finance and Operations”. This connector has an action called “Get records” and as the following screenshot shows, I use this action to select all open equipment loans.

PowerApps 6.PNG

Two things worth nothing in the Filter Query I am using to find the correct records:

  1.  An empty date in an D365FO record is defined as “1900-01-01T12:00:00Z”.
  2. I can use Dynamics Context in the query, but it most be enclosed in ”.

Please note: Depending on your locale, the statement separator can be either “,” or “;” and the system may expect single or double quotes.

For each record found by the query, I use an Apply to each construct to update the returned date (sorry for the Danish) in the LoanedEquipments data entity.


As the above example shows, it is relatively simple to create functionality that combines a user interface (PowerApps) with data processing (Flow) using the Power Platform in combination with D365FO. In my example I also create an item in a SharePoint list. This is mainly to demonstrate this capability and could have been omitted.

In the next part in this series, I will show how to create a record in D365FO based on the data stored in the SharePoint list. Stay tuned…




Published by Henrik Marx Larsen

This blog is my personal contribution to the Microsoft Dynamics 365 for Operations and Finance (D365F&O) community debate. Having worked with Axapta / Dynamics AX / D365F&O for 20 years , I think I may have some interesting insights and views to share. However, I tend to always look forward so I will mostly be writing about current subjects. I have a vain hope that my musings may inspire some of you and provoke some new thoughts in the interest of our community. My day job is to work as a Senior Technical Specialist at Microsoft and help take D365F&O capabilities to new and existing customers. Please note, the views expressed in this blog are mine alone and do not necessarily reflect the views of my employer, Microsoft.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: