Integrating PowerApps and D365 for FO
Now, when PowerApps application is ready, I’ll show you how you can easily and seamlessly integrate it with D365 for FO. You’ll need D365 for FO spring release’18 or later version (platform update 15 or higher), since this integration feature appeared in spring release’18.
According my scenario I would like to open PowerApps application from D365 for FO customer details page and would like automatically pass tax payer ID from D365 for FO to PowerApps application. To do this, first, open customer details page in D365 for FO, we’ll assume, that tax payer ID is stored in “Government identification – ID number” field. Imagine, that I’m filling in details for new customer and just filled in tax payer ID number, and now I want to fetch all company details using this ID.
D365 for FO customer details page – Tax payer ID field for our scenario
Please, note that starting from D365 for FO spring release’18, there is special PowerApps button in every form. Using this button you can add PowerApps application to any form in D365 for FO.
PowerApps button in D365 for FO forms
Let’s add our “Organization Info” PowerApps application and setup it so that application will automatically get tax payer ID from D365 for FO customer details page. To do this, click “Insert a PowerApp” menu item, you’ll see “Insert a PowerApp” dialog window. You will new PowerApp App ID, this ID looks like GUID and can be found at PowerApp application details page at web PowerApps home.
In “Input data for the PowerApp” select control with “ID number”, value from this control will be automatically passed to the PowerApp. For our app we’ll select thin application size. Now you can click “Insert” button and app will be added to the list of available PowerApps applications for the D365 for FO form (customer details in our case).
Insert a PowerApp dialog
“Organization info” is on the list of available apps
In order to use value from D365 for FO field in PowerApps application, we shall modify our app. Go to PowerApps application designer and setup default value for tax payer ID field in PowerApps application designer. Use global variable “FinOpsInput”, this variable contains input value from D365 for FO form.
Use “FinOpsInput” global variable to supply a default value to PowerApps
Now let’s try to call our PowerApps application from D365 for FO customer details form. Note, that value from “ID number” field has been automatically transferred to PowerApp. In PowerApps application you just click “Find” button and get all company data from DaData web service.
Calling PowerApps application from D365 for FO
When you build a canvas app that will be embedded in a Finance and Operations app, one important part of the process is to use the input data from that Finance and Operations app. From the Power Apps development experience, the input data that is passed from a Finance and Operations app can be accessed by using the Param("EntityId") variable.
For example, in the OnStart function of the app, you could set the input data from Finance and Operations apps to a variable like this:
If(!IsBlank(Param("EntityId")), Set(FinOpsInput, Param("EntityId")), Set(FinOpsInput, ""));