Insert a Power App into D365 for Finance and Operations

Hello all,

During these challenging times, I figured the best way for me to contribute to the world is by sharing some knowledge. I am hoping my blogs will help someone out there solve an issue they are encountering while working with these Microsoft apps.

I am going to rant a bit about where the idea for this solution came from and a bit of my background. I am not a developer by nature, actually come from the accounting school. In recent times the term “Citizen Developer” is getting a lot of buzz around the Microsoft world. Today I am a big believer that this actually could be a new position segment in the future. Just a few years back, it would have taken months to develop solutions like the one I am going to demonstrate next.  Although the POC (proof of concept) to market software solution using Power Apps is a lot faster, it must not be taken lightly. Proper Dev-ops (Document, develop, test, monitor, feedback, deploy) must still take place. 

Ok, now that I gave you guys a piece of my mind, let’s get to the solution. This solution extends the asset tracking capabilities of D365 F&O. While I believe that the asset module is great from an accounting stand point, it needs work to be a good person Asset Tracking management solution. Most organizations issue laptops, monitors and other assets to employees and then wish to track the whereabouts of those assets. This is where my solution comes into play.

Let me start by showing you how it works. I already embedded the app into the Fixed Assets form in D365 F&O.

 

The error message that appears annoys me so much, I still haven’t found a way to get rid of it. It doesn’t prevent the app from working correctly, it just provides a bad user experience. If anybody knows how to stop it from popping up when using data from D365 F&O, please comment below.

2020-04-03 12_06_33-Movies & TV

How to pass input information from D365 F&O into a Canvas Power App? 

Using the OnStart property on your PowerApp, you need to use the function Param(“EntityId”). This function basically expects input from a source at the moment you open up the app. In my case, I am setting a variable called FinOpsInput to store the data as text passed from D365 F&O. Also, I am setting up a condition to navigate to the main asset page if the variable FinOpsInput is blank when the app is started. I did this so that when a user opens the app outside of D365 F&O  then it will navigate directly to the main screen.

If(!IsBlank(Param(“EntityId”)),Set(FinOpsInput,Param(“EntityId”)),Navigate(‘MainAssetTracking Screen’));

2020-04-03 11_55_56-FixedAssetTracking_Contoso - Power Apps

The second step of linking the app to D365 F&O is to go to the form that you would like the app to be in and then click on the power app icon at the top right of the form

2020-04-03 15_52_24-OneNote

the trick is to use the Input context for the app field to specify the field that you want to pass to your app. In my case, I want to filter the Fixed Assets data entity by the Asset number.

AssetTracking

Once that’s done, make sure you refresh the screen to view the app. In order to access the app, just select the record you want to view in the app and then select your app from the list.

2020-04-03 15_56_46-Fixed assets -- Finance and Operations

Tracking additional fields outside D365 AOT?

In my app, I am tracking additional fields not available in the Fixed Asset data entity, such as employee name, loan date from and to, etc… (This is a demo app, you can add as many fields as you deem necessary for your case)

For that purpose I chose to track them in a SharePoint list. You could have used a SQL database or CDS if available. What the app is doing when it loads from D365 F&O, there is a gallery that’s being filtered by the asset number passed in the variable “FinOpsInput”

2020-04-04 12_14_19-FixedAssetTracking_Contoso - Power Apps

Filter(FixedAssets_1,’Fixed asset number’ = FinOpsInput)

then when you click the “View Asset Tracking” button, there is a power automate flow that runs. This flow checks to see whether that asset number has already been added to the tracking list (The SharePoint list I created to track the fields not available in D365 F&O), if the asset has not been added then add it to the SharePoint list.

2020-04-04 12_17_17-FixedAssetTracking_Contoso - Power Apps

GetAssetfromD365.Run(GalFilterfromD365.Selected.’Fixed asset number’);
Refresh(FixedAssets);
Navigate(‘MainAssetTracking Screen’);

The name of the flow is “GetAssetfromD365” and it is pretty straight forward.

It first get’s the asset number from Powerapps, then it filters the Fixed Assets data entity  using  that asset number

FixedAssetNumber eq ‘@{triggerBody()[‘GetAssetID_FilterQuery’]}’

2020-04-04 12_19_46-Edit your flow _ Power Automate

then, I filter the SharePoint list using that same asset number

2020-04-04 12_22_32-Edit your flow _ Power Automate

I then added a condition to check whether the number of rows returned from the SharePoint list is greater than zero. If it is greater that zero, then that means the asset has already been added to the SharePoint list (The Yes condition). At that point end the flow.

If the result is zero, then add the fixed info to the SharePoint list using the info from the D365 F&O Fixed Assets entity.

2020-04-04 12_26_30-Edit your flow _ Power Automate

The condition to check uses the length function in Power Automate to check the quantity of items being returned from the SharePoint list

length(body(‘Get_items’)?[‘value’])

The SharePoint list is used to track the person the asset was assigned to, if it was a loaner asset the date it is loaned from and to. You could track as many other fields as you want.

I am using the Office365 users picture to include it on the app . This way it adds visually the owner of the asset

2020-04-04 12_33_12-FixedAssetTracking_Contoso - Power Apps

Other features of the app:

  1. Notifies the user when an asset has bee assigned to them via email

2020-04-04 12_36_28-FixedAssetTracking_Contoso - Saved (Unpublished) - Power Apps

2. It notifies an employee when a loaner asset is due. There is flow that runs daily and checks the loandate to field and if it is equal to today then it sends out the remainder email.

Hope you guys enjoyed this post and hopefully opens up your mind to see what the Power Platform combined with D365 F&O can accomplish. This app was created as quick POC and definitely can use some cleaning up in the code. Don’t forget to name all your objects such as comboboxes, buttons, images an other things properly. It will help you debug later. Also, hopefully my accountants can see that you don’t need to be a full developer to create usable applications and quickly add value to your organization.

Stay safe and until the next time.

Juan Sebastian Grijalba, CPA

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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