You can now use Microsoft PowerApps with D365 Finance and Operations. (D365 Supply Chain Management, Finance, Commerce)
I always struggled with finding a business case for doing this. Why not just customize F&O?
But I actually came up with a scenario that I think could be useful.
Read on if you are interested.
Sometimes you want to quickly see what items are on a sales order. You don't need all the bells and whistles, dates, categories, what have you. You just want to see what's on that order as far as items/products go.
Right now, you will need to go to the 'All Sales Orders' screen, select the order from the grid, then go to the lines, wait until all the stuff you DON'T need is loaded, and then discover you selected the wrong order, and have to start all over again.
What if I could just bring up a super simple screen that ONLY shows the item, description and qty for the order I selected?
This posts outlines the steps to complete the above scenario. Let's get started.
I got most of the info from the link below, and the helpful
"Finance and Operations Insider Program" Yammer community.
You can either start with a 'Table' (Entity) and have a base layout generated based on the data (you do this by clicking on the right arrow) - or start with a blank app.
Since we're building a super simple app, I'm starting with a blank app:
This will list the available F&O instances in the 'Choose a dataset' window that comes up. Select the one you want to connect to, and then select the table (= F&O Data Entity - ) you want to connect to.
In this example we want to see sales order lines, so we're picking the 'CDSSalesOrderLinesV2' table, and click 'Connect':
As you add this, the app will actually load the data, so be patient.
It shows a set of default fields on the grid with their data.
We will change these fields so the grid has the ones we need.
Now we have our very basic app.
As it sits now, the app now shows ALL sales Order lines.
When we call the app from F&O, we only want to show the lines for the selected order.
We need to implement some logic that filters the rows.
This section has info on that:
When we add the app to F&O, we can specify which field is going to be passed to the app when the app is started from F&O.
The framework will put this value in a parameter called 'EntityId'.
Parameter 'cmp' is passed with the Legal Entity value.
When the app starts we want to use that parameter, and put it in a variable so we can filter the records using that variable.
For our scenario, that will be the sales order number.
First step for this is to put the parameter in a variable.
Sample code for that is in the article linked above, so let's implement this (with a small change).
In the tree view, select the 'App' node.
Make sure that the 'OnStart' event is selected in the top left.
Expand the formula section so we have more room to put the code.
Then enter the code snippet below. Note that variable names are case sensitive.
If(!IsBlank(Param("EntityId")), Set(FinOpsInput, Param("EntityId")), Set(FinOpsInput, "EMPTY")); If(!IsBlank(Param("cmp")), Set(FinOpsInput, Param("cmp")), Set(FinOpsLegalEntity, "")); Notify("EntityId parameter: " & FinOpsInput);
TIP: For testing/debugging it is useful to provide some output when the app is called. That's why we are putting the 'Notify' command in the code, so we can verify that the proper value is passed from F&O.
The next step is to actually filter the content in the view, using the new 'EntityId' variable.
Click on the DataTable in the tree view, and enter the code below in the formula window:
Filter(CDSSalesOrderLinesV2,'Sales order (SalesOrderNumber)' = FinOpsInput)
You have probably noticed that annoying red 'X' shown in the table view. I think this is due to the naming of the sales order field on the entity. It makes the code generate an incorrect field name.
To further investigate and fix, click on the down-arrow next to the error, and select 'Get help for this error':
Click in the 'Text' field and delete everything so only 'ThisItem' is left.
Then enter a period, and the field list will pop up.
If you scroll down, then you'll find that the field name is NOT just 'Sales Order', but actually
'Sales order (SalesOrderNumber)'
Just select that one and the error will go away.
That should be it for our app. Hit CTRL-S to save it again.
In order to use the app in F&O, we first need to publish it.
Easy enough, just click 'File' in the top left, and hit the big 'Publish' button.
Click 'insert' and hit F5 to reload the page.
To test it, first select a sales order from the grid, then click the PowerApps button and select your app.
If everything went well, it should show the sales ID in the notification and the sales lines in the grid:
- If you are making changes to the app, make sure to publish the app before testing.
- Sometimes it is hard to know if the updated app is executed or not. I usually change something simple, like the text in a header to make sure that the latest version is executed.
- If you want to remove the app from F&O, or edit the F&O settings, right-click on the PowerApps button and select 'Personalize: PowerApps'. This will bring up a screen where you can edit or delete (remove) the app:
There is also a way to embed a PowerApp into the F&O UI directly via F&O development. See part 2 for details on that.
Hope this was useful.