web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Call a Power Automate ...
Power Apps
Unanswered

Call a Power Automate Flow from a Model Driven App to create a CSV

(0) ShareShare
ReportReport
Posted on by 50

Hi there,

 

I'm really new to Power Apps and am in the process of building my first Model Driven App. This MDA is replacing a spreadsheet system that was quite data centric.

 

With relative ease I have created a multi-form Model Driven App to manipulate and store the data. However what I wanted to prove now is whether I can extract the data from one of the data tables and create a csv. This is how the source system current users the data from the spreadsheet I am replacing. I thought about doing this in Power Automate however I am unsure how I can trigger a flow from a new Command Bar Button on the Main view table form.

 

I essentially want to pass the data to the flow based on the contents of the table. The flow would rename columns etc and output to a file location or similar (just a proof of concept for now).

 

There maybe better way to do this; however I was looking for any guidance. I have seen quite a few guides and videos online for how to call from a canvas app, but not a model driven app. I also wasn't sure if calling via HTTP was the only route as this seemed like overkill and thought a powerfx function on a button would do the trick. However I can't seem to see how you would do this.

 

Thanks for your assistance

Categories:
I have the same question (0)
  • Ethan_009 Profile Picture
    4,838 Moderator on at

    Hi @dgaskellgw ,

     

    Can you share a pic where is your button located?

    There's are multiple ways to call flow depending on where it needs to be triggered and how.

    As you said regarding to a button, there are few methods:

    Method 1: Considering you wanna trigger flow on Record and save its details in a document and store in its respective folder in SP or something.

    You can keep a hidden field as flag to trigger the flow based on Modified property of Record. Then perform further action.

    So your button will trigger JS -> JS flicks the flag and saves record -> Flow is triggered.

     

    Method 2: You already have a Flow option on the Ribbon button. This uses old CDS connector (grey color icon) when you create a flow. Trigger will be "When a Record is selected". This will directly trigger the flow in which Record you want to trigger.

     

    Method 3: You already mentioned this one, HTTP method to trigger the Flow. This can be invoked with JS even on main page.

     

    Hope some of these gives you some idea of how flows can be triggered in Model-Driven App.

  • dgaskellgw Profile Picture
    50 on at

    Hi @Ethan_R 

     

    I've attached a couple of files. 

     

    Essentially I have currently edited the ribbon to add a new command button. This is on the Main Grid Ribbon and resultant page for one of my data object tables. For My POC I would like to extract the whole data table of data (e.g. not just one row) and create a new csv file. This mimics the users current excel system which has limitations. The MDA masters the data and relationship mappings, this then is exported from dataverse into their existing systems. There maybe other options; however I wanted to POC creating a csv file of the data as they do now.

     

    I considered the existing flow option; however I could only see this catering for One Selected Row or it kicked off a flow for each selected row. So not what I required. e.g. Method 2

     

    I discounted a variation of Method 1 as again, this seemed to be be on a per row basis. I guess I could have a sub view of exports and try that and select the parent; but hadn't considered it that far yet and not even sure if that's possible.

     

    I'd hoped there would be a direct method to call a flow rather than Method 3,  but that may not be the case and http call, passing the whole data as json maybe option (performance may need to be considered as one table has 4000 rows)

     

    As per my original post; what i'm trying to do may not be possible; however as i'm new, i'm just trying items now. There maybe a better method to do this in a flow with dataverse access that helps me get the data and produce a csv. I'd just hoped I could kick off a flow from an MDA in a similar way as a canvas app (e.g. following something like https://www.youtube.com/watch?v=UZdngrwWsqA or https://www.youtube.com/watch?v=tQCBWMR7T64&t=303s). Kicking off a flow from a Model Driven App is basically all I need initially and I can then work out the best way to do this with the data; this maynot even be in the context of the data table.

     

    I Guess I could logically create a new data object called Exports (or similar); so the user requests an export for a table name - this kicks off a flow; gets the data and produces the csv to a file location. However in this instance i'd be triggering a flow off a new row being created, rather than calling the flow directly via the Power Apps trigger (if that makes sense).

     

    Thanks Again

     

    Main Table View with Ribbon Button.png
    Main Grid Edit in Power Apps.png
  • Linn Zaw Win Profile Picture
    2,996 on at

    @dgaskellgw  I am afraid Method 3, is the only way to go for your scenario (unless you want to create an additional table to trigger the Exports) since there is no native way to call the cloud flow from the command button PowerFX as far as I know.

     

    Instead of hardcoding the URL of your HTTP flow @ScottDurow has added the Environment Variables in Smart Buttons with which you can run the flows with an ALM-friendly approach.

    https://d365demystified.com/2023/01/17/run-webhook-smart-button-in-ribbon-workbench-xrmtoolbox/

     

     

     

  • Linn Zaw Win Profile Picture
    2,996 on at

    @dgaskellgw 

     

    Please let us know how it goes when you got it working.

     

     

  • ihui Profile Picture
    12 on at

    Hi! Wondering if you were able to accomplish this?

  • Parvez Ghumra Profile Picture
    1,579 Moderator on at

    @dgaskellgw 

     

    If your overall objective is to be able to export the data to a CSV file, have you considered the out of the box Export to Excel functionality that would be available from a view? You can then save the Excel file as CSV?

  • ihui Profile Picture
    12 on at

    We considered it but I dont think it'll fit our needs. Also some people made the complain of too many clicks.

  • Ethan_009 Profile Picture
    4,838 Moderator on at

    Hi @ihui ,

     

    There's another way to do the stuff

    Blog

     

    Hope this helps

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 483

#2
WarrenBelz Profile Picture

WarrenBelz 399 Most Valuable Professional

#3
11manish Profile Picture

11manish 327

Last 30 days Overall leaderboard