Business Applications, Dataflow, Dataverse, Power Automate

Dataflows for Power Apps: run import from the app

As you know I am a very big fan of Dataflows. The biggest ask from me was always the ability to trigger the Dataflow refresh on demand from a Power App.

Initially, Dataflows you could only run from the maker portal. You need all sort of “powerful” security roles and permissions to do so.

Dataflows on a maker portal

As a user I want an ability to trigger a bulk import with Dataflows from Power Apps UI.

As an admin I want my users with the restricted security roles to be able to successfully run Dataflows from Power Apps.

Previously, we used a very resource consuming workaround to make this happened for our users.

Last month we’ve got proper tools for this with the new Power Automated trigger and action.

This how you could implement the bulk import trigger from Power Apps for Dataflows via Power Automate.

Step 1. Add a custom ribbon button to initialise the import.

You could do it with a traditional Ribbon Workbench way or a new and fancy way:

Your button will look very similar to mine:

Trigger bulk import from the Power App UI

Step 2. Call a JavaScript from the ribbon

Your button will trigger a JavaScript function. My function looks like this code below:

 this.StartChargesImport = function (formContext) {
        'use strict';
        Xrm.Utility.confirmDialog('Are you sure you want to schedule bills and meters import for this batch? It will take aprox. 15 min for files to load. Please check your notifications and review the Process record for the updates.',
            function () {              

                //populate start charges import date to trigger flow
                var startChargesImportDate ="tm_importchargesstartdate");

                if (startChargesImportDate == null) return;

                var currentDate = new Date();




It updates the import start date and the status on the process header, also resets load records counts. THe record gets saved the next step will be…

Step 3. Dataverse connector -> When a record is created, updated or deleted Power Automate

Set one of the fields you updated from the JavaScript above as a column filter on your trigger. I set it to the Import Charges Start Date field.

Dataverse Power Automate trigger

Do whatever you need to do in your Power Automate flow then call the following action:

Power Automate refresh Dataflow action.

We use environmental variables for Group and Dataflow name.

Your Dataflow refresh settings has to be set to manual:

Power Query – refresh manually

Step 4. When a Dataflow refresh completes trigger for Power Automate.

It’s an example of the refresh complete. No environmental variables here. We do it differently in our production system at the moment. But here you could check if the refresh was successful then update your record counts and statuses or send error messages to the Team channel if the run has failed.

When a dataflow refresh completes trigger.

This completes the whole ‘magic button” story to me.

Please comment or message me if you want to talk about Dataflows or Power Platform.

1 thought on “Dataflows for Power Apps: run import from the app”

Leave a Reply

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

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