Exchange Rate Loader PowerApp for D365 F&O - Part 3

Is this blog I will cover off the following bits from previous post:

 1. Put some logic in to allow concurrent loads as currently only supports single person executing at the same time.

2. Allow for dynamic naming of files.
3. Provide a downloadable excel template for users so they can see the required format.

To achieve the concurrent loads for multiple users I have placed all the data into blob storage into a separate subfolder which has a unique GUID, this will run when the button for upload is pushed.






Then I made adjustments to the ask in power apps stage to pass over the variable:




I also adjusted the later stages where we had a step containing the file path like below:



Then on the response to function app to zip the packages I have updated the format as below:


This means now that when I run the loads individual subfolders are created to hold the packages and Zip file and you can have simultaneous loads happening at once.

To accommodate the dynamic naming of files I made the adjustment to replace the placeholder file name in Manifest with the file name passed over as part of the attachment control on the PowerApp, this uses a replace function before I convert the string to a XML file.


The following is the result:


The third part is to create a export to template that users can populate before they upload, for this I had to convert the load to a CSV type, but in practice it wont have any real impact on the process.

I created a new button on the PowerApp:


Behind this is sitting a flow which I am passing one parameter which is the Manifest and passing back one parameter which is the URL of the blob storage.


The purpose of the flow is to basically extract the field data from the XML and parse that into the column headers for the CSV and then prompt user to download the CSV, the way I achieved this as follows:


The first steps I am initiating the variable for the Manifest, converting it to an XML format from a string and then to a JSON format as I find it easier to work with JSON in PowerAutomate, I then use the Parse JSON function to split the JSON down into it component parts:


I then initiate a string variable, then use the EntityMap in a Apply to Each to loop through the JSON to get the EntityField Values. This value is then used with a Append to string and a concatenate to build a string delimited by "," which can then be added to a file.


I then create a new Blob file in the blob storage account and use the string variable as the blob content, then I create a path to the file and pass then back to PowerApps which when run causes the app to trigger a download:


That's all for now, I am going to do one final entry on this blob as through testing I discovered that there was a timeout on long running loads over 2 minutes for the respond to PowerApps for error messaging this means I found a work around which is overall a better solution using DataVerse table, but I will cover that in part 4.

























 





Comments

Popular posts from this blog

"Exception while trying to get Virtual Entity metadata for entity" Error on Data Events

Electronic Reporting displaying Legal Entity Email/Phone by custom Address Purpose

Custom Connector for HMRC VAT Number Validation