In this post we will see how we can leverage power app and Power automate to upload any document in document attachments in F&O.
In standard application there are multiple entities present which can be use to upload attachments in F&O. One of them is widely used entity called EcoResProductDocumentAttachmentEntity or ProductDocumentAttachments entity.
Let see how we can utilize these entities as reference for creating any entity for any custom table. I am taking the example of fleet management form FMVehicle just for the demonstration purpose.
So, the scenario is attaching vehicle images to the different vehicles present on this form using power app and power automate.
We will create a simple power app which will take image and upload it to the document attachment form. When we click on upload image button in power app a flow will be triggered which will call create action from F&O connection and call the custom entities created.
In order to achieve this, I have created two different entities ASPDocumentAttachmentEntity and ASPVehicleDocumentAttachmentEntity. These two entities are nothing but copies of EcoResProductDocumentAttachmentEntity and EcoResDocumentAttachmentEntity with minimal changes.
You can download project associated with this blog post from my github page to see what changes I have done. Below is the simple canvas powerapp created which is going to be embedded in F&O vehicle form screen where we will be attaching image in document attachment associated with vehicle Id. You can get more info about how to embed power app in F&O here
This is how form looks like when you embed power app on vehicles forms. You can open this on tablet, phone take pictures and attach. However, when you are using laptop or desktop, app is going to ask you to upload the image.
Once you upload image using media control on PowerApps and click on upload image button, the image is Visible in document attachment form. I have uploaded truck image to the vehicle ID “Litware_McKinley_1” which is of type truck.
Now question might arise in your mind that how we are going to find out the vehicle record to attach image we are going to capture using this app.
This is where data sent from F&O comes handy. When you add power app on F&O form system asks us to enter input context for the app which you can capture OnStart function of the app using statement like below.
If(!IsBlank(Param(“EntityId”)), Set(FinOpsInput, Param(“EntityId”)), Set(FinOpsInput, “”));
Using embed app screen you can pass only one context to the app, however after 10.0.19 you can receive legal entity information using following syntax on the OnStart event of the app
If(!IsBlank(Param(“cmp”)), Set(FinOpsLegalEntity, Param(“cmp”)), Set(FinOpsLegalEntity, “”));
You can read more about passing values over here.
Below is the flow which I configured and added to the app. The flow is very simple, you Just have to use create record action from F&O connector and fill in the required fields like vehicle ID , attachment from , legal entity from the data entity. All these fields you can get it from the power app.
That’s all for now. If you have any questions, feel free to comment on the post.
Hi, I am trying to pass values like these into F&O (Product Document Attachments table = EcoResProductDocumentAttachmentEntity), Even though I am passing ‘documentattachmenttypelegalentity’ =USMF”. My data when doing to docuref table is reflecting the ‘refcompanyid’ as dat.
I am using the app outside in make.powerapps.com and not as an imbedded ap. Is there any way you can direct me and provide a bit of support.