Embed Power Apps in Dynamics 365 Finance and Operations

Embed Power Apps in Dynamics 365 Finance and Operations

Thanks to the Power Platform, the options we have to extend Dynamics 365 Finance and Operations without writing code have multiplied. In previous articles we saw how we could take advantage of Power Automate flows to do so, and this time, we will focus on the different ways we have to embed Power Apps canvas applications into FnO forms.

Preparing the application to interact with F&O

For this example, we have prepared a canvas application that will show the total amount of sales made to a particular customer, grouped by the status of the lines, so we will have the total amount invoiced, delivered, backorder and canceled. The ERP data can be used within the application through the use of Virtual Entities or Virtual Tables. You can get more details on how to configure them in the following article by Aurélien Clere.

Canvas app con virtual entities

Once we have the application created, and since this application is going to be executed from the F&O context, we will probably be interested in being able to visualize the information filtered by the context in which we are. In our case, this context will be the company (DataArea) and the customer for whom we want to visualize the sales. We can get this context in a very simple way, since F&O sends 2 parameters to our Canvas App (until version 10.0.19 it was only one). These parameters are the legal entity (dataAreaId) and the second one we can choose based on the place where we insert our app. We will use the client code.

To receive and use these parameters in our application, we will put the following lines of code in the OnStart method of the application:

The EntityId will contain the customer account, and with the cmp parameter we will receive the company code. Once both values have been set in the FinOpsInput and FinOpsLegalEntity variables, we can use them to filter the data of our application.

Once our application is finished, we only have to publish it and share it with the users of our organization who are going to use it.

Embed application in F&O

Now we have everything ready, it only remains to embed the application where we want. To do this, we can follow two different paths. The way of personalization, or the way of customization or development. So, which is the right way? Well, the answer to this is that it depends. It depends on the capabilities and needs of your organization.

The biggest advantage of the customization path, obviously, is the independence that the system gives you to make simple modifications without the need for a developer. On the other hand, the management and maintenance required to make these customizations available to the rest of the users is greater, and at any time (although it should never happen) a user with sufficient permissions could delete this customization “by mistake”, losing the work done.

On the customization side, these modifications would remain in the binaries of the application itself, being effective for all users at the time of deployment, obviously, without the need to distribute the customization and not being able to be removed by users with sufficient privileges, on the other hand, you have to have a developer for it.

Now that we know the advantages and disadvantages of both processes, let’s see how to perform each of them.

Embedding Power App through Personalization

The next thing we are going to do is to navigate to the form where we want to embed our Power App, in our case we will insert it in the Customers form, as a new FastTab inside the customer information, so we go to Accounts receivable > Customers > All customers, and click on one of them to enter the detail.

Once in the client, go to Options > Personalize this page, and on the customization bar that appears, click on the 3 dots () and click on Add an application.

Embed power app in Microsoft Dynamics 365 Finance and Operations apps

Next, select the area of the form in which you want to insert the application (I have clicked on the fast tabs), and click on the Power Apps button.

Add power app canvas app in microsoft dynamics 365 finance and operations through customization

Now the system will ask for the following data:

  • Name: The name you enter will appear as the title of the Fast Tab to be added
  • App ID: The ID of the application to be embedded
  • Input context for the app: Here we indicate the value we want to pass as parameters (“EntityId” parameter) to the Power App in addition to the dataAreaId (“cmp” parameter)
  • Application size: Wide or Thin
Fill power app info in dynamics 365 finance and operations

To obtain the identifier of our application, we can go to make.powerapps.com and see the details of the application we have created.

Power app details - Microsoft power platform

Once we click on the Insert button, we can see our application embedded into our form, without the need to develop, and, as we can see, showing the data previously filtered by the customer we have selected.

Power app embeded in dynamics 365 finance and operations custtable form

Finally, we can save the view with the name we want, and distribute it among the users who need to use it.

Save views dynamics 365 finance and operations

Embed Power App through Customization (or development)

In this second way, we are going to embed the Power App inside the same form, by means of a small customization or development, so we will need Visual Studio to achieve it. The first thing we are going to do, is to create an extension of the form in which we are going to insert it. For our example, we are going to extend the CustTable form, adding a new FastTab, in which we will insert a control of type Power Apps Host.

And finally we fill in (at least) the following properties:

  • App ID: The ID of the application we want to embed (and that we obtained from make.powerapps.com)
  • Data Source: The data source of the form we will use to send the EntityId parameter
  • Entity Id Field: The field that we will use to send the EntityId parameter
    • Using these two properties, we achieve the same effect as when filling the input context by means of personalization.

Now, let’s compile and see the results.

Conclusions

The conclusions are quite obvious: thanks to the Power Platform, the possibilities of extending the ERP have multiplied infinitely. We can now afford to think outside the box, let our imagination run wild, and build, with some creativity, components that we could not count on until now within our forms.

As for the way to choose (customization or personalization), I have clear which is my favorite, what about you? But as I indicated above, I don’t think there is one better than the other, just one more in line with your needs and capabilities.

9 comments / Add your comment below

  1. i appreciate the info in your article — I am having some trouble with cross-company queries in the PowerApp.
    I have a Canvas app, using the Dynamics Finance connector…I am attempting to filter data entities with something like this:
    ClearCollect(CachedAssets,Filter(FixedAssetsV2,Company = FinOpsLegalEntity));
    ClearCollect(CachedCusts,Filter(Customers,Company = FinOpsLegalEntity))

    but i get no results unless the legal entity is the default legal entity of the user…
    Any ideas for how to get a cross-company scenario to work, to allow a user to operate in more than one legal entity?

    1. Hi Tim, thanks for your comment :).

      The problem is within the Finance connector. It only retrieves information of the Default company that the user has configured in Finance user preferences, so this filter has no sense.

      If you want to get data from all the companies, the best approach would be use Virtual Tables and the Dataverse connector instead of using the Finance connector.

      Hope this helps you, and thanks for reading the blog!

        1. Hi, sure.
          It is not needed to “create” a virtual table connected with F&O, but just to make it available!
          All public data entities in F&O can be used as Virtual Tables in Dataverse. To make them available, you should go to the linked Dataverse environment > Open All tables, and search for Available Finance and Operations Entity. You can take a look to its records, and see that you have all the public data entities. The last step, would be to click con the Visible check box and save.
          After that, you will have the Virtual Table available in dataverse. (You can filter in Tables by mserp and you will get all the F&O virtual tables.

  2. HI,

    I want the application to run in full screen mode.

    is there any settings for that because the application is running in a small window which is looking very bad.

  3. hello, i followed ur instructions but i am getting this error message after i compile
    Severity Code Description Project File Line Suppression State
    Error Path: [AxFormExtension/CustTable.MounirTest/Design/Controls]:Control ‘AxFormExtension/CustTable.Test/Design/Controls’ has child ‘PowerAppMounir’ which is not allowed at its current location by pattern ‘Details Master’. Test (USR) [Test] C:\AOSService\PackagesLocalDirectory\MounirTest\MounirTest\AxFormExtension\CustTable.MounirTest.xml 0

    1. Hi Mounir, sorry for the delay in my answer.

      Can I ask you at which level has you inserted the Power Apps Host control? I’m not sure, but maybe you have included the Power Apps Host control in a place that is not allowed by the Details Master form pattern.

      So, what you need to do, is for example, go to Design / Tab / TabPageDetails / TabHeader, then create a new TabPage inside of the tab TabHeader. After that, you can add the Power Apps Host control in that new TabPage.

      Hope it works in that mode.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Uso de cookies

Este sitio web utiliza cookies para que usted tenga la mejor experiencia de usuario. Si continúa navegando está dando su consentimiento para la aceptación de las mencionadas cookies y la aceptación de nuestra política de cookies, pinche el enlace para mayor información. ACEPTAR

Aviso de cookies