This guide offers a precise remedy for integration friction by exposing the subtle ownership constraints that often derail professional development in the Power Platform. It effectively bridges the gap between low-code automation and the technical rigor of code-first applications.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
How to Call Power Automate Flows from a Code App (and some gotchas)Added:
You can now call Power Automate flows from code apps. This is a long requested feature for code apps and something we're going to dive into today and how to add a flow to a code app and we're also demoing. Really excited to showcase this. Charles, do you want to take it away?
>> Yeah, sure. Thanks, Josh. So, around a week and a half ago, this was introduced for um Power Automate and Code Apps where you can add your flow to the code app. As Josh said, it's in preview at the moment, and we're going to show you how to do it today. So, we're looking at the documentation at the moment. There's a note here to say important. Only flows that use the Power Apps trigger are supported. So, don't try using different trigger types because they're not going to be able to integrate. But, um, I'm not sure why you would necessarily need to in the first place with those. So, with the prerequisites, of course, you need a code app. I mean, that's a given.
You need a Power Automate flow that's solution aware. That's really important.
And it's got to be an instant flow because of course the trigger type needs to be a Power Apps trigger. So you're triggering it instantly to occur. And then yeah, there's some information about if you haven't created a code app, if you haven't added your flow to a solution. Hopefully we're all aware of these kinds of things. Something that's really important to note is this mpm package version for the Power Apps package. So with the sample that comes through from GitHub, that's on an older version. So just change the version number in your package.json and then once you've updated that do npmi or npm install to update the package and then as long as you're on 1.1 1.1.1 or later you'll be able to use the power automate integration.
So should we get started?
>> Yeah and just to add to that before we jump into the the fun part. If you've not initialized a code app or this is your first video you're seeing for power squared we have covered this. go and check out our other videos and we break it down and show you how to get going with it. So do check that out if you haven't already.
>> Thanks Josh. So today we'll just give an overview as to what we're working with.
So we have a solution here with a code app inside it called asset register and it's an asset tracking um solution and we have a cloud flow that is called when an item is assigned. So essentially when one of these assets is assigned to someone we want to tell them we want to send them an email to say we've assigned this to you and then we have a flow for that which is very simple flow. So we've got this trigger that Microsoft said you have to have with a code app for the integration. So when power apps calls a flow version two we've got some parameters for this. So information will send into this flow. So an email address and an item ID to say which item it is.
And then we're going to send an email and we're going to email the person who we've passed through in the parameters telling them that an item has been assigned and giving them the ID of the item. Now, of course, in the real world, you go into way more detail with this.
This is just an example and from this example, you can then take it to anywhere you need to go as far as power integration with code apps. Yep, sounds good. So, we've got the flow, we've got the code app. Let's have a look at what we need to do to get them to talk to each other, right?
>> Okay. So, of course, the usual thing, we need to run some terminal commands. So, this one is npx power apps list flows.
As you will hopefully know from our previous videos that npx is what we're going to npx power apps is what we're going to be running in order to run that power apps package. And then list flows is the action that we're going to be using for this particular one. So, we'll copy that. We'll go into VS Code and then we will open up our terminal and we're already running the app at this stage as you saw earlier. I'll just create a new terminal instance. Paste that in and then press enter. Now we're already logged into our tenant and our environment here. If you don't know how to do this kind of thing, we've got videos on this. So feel free to go through our channel and you can find out all of this stuff. So now what we're seeing in front of us are a list of all of the flows that we've got inside that environment. And you can see the email when an item is assigned uh flow that we have here and we have a flow ID for it.
So let's go back to this. And it says the command outputs a table of available flows which is what we're looking at.
Only solution aware flows listed. So if you're looking at the flow and you can't see it, maybe it needs to go into a solution. And you can also filter this list which is really nice. So use the d- search option and then you can search for say if you want a flow that has approval in the name you can search for that just in case you do have hundreds of flows in that particular environment.
So then the next step of course is that we need to add this to our app. So we have some more code here so we can copy that and then they've got an example of how it should look. So let's paste it into our terminal npx power apps. So we're running the power apps package.
We're doing the add flow action this time. And then we're passing in a parameter of a flow ID. And we've got our flow ID here. Of course, everything's to hand. We can just copy that and paste that in. Press enter.
After a little bit of loading, when it's gone to Oh, come on.
Okay. So, I need to have access to that flow first.
>> Okay. So, let me add you as a co owner.
This will catch loads of people out for doing this for the first time.
>> If I try again. No. So, I might need to just go into the solution and change the connection reference then. All right.
So, we're back in VS Code now and we did have a little bit of a change where um we had an error coming up saying that it can't add the connection or can't retrieve the connection, can't add the flow basically because Josh created the flow. It wasn't my connection, but I'm trying to add it here. I need to own that connection. So, I needed to create the connection and then swap the connection reference over to using my connection instead. And then now as we try to add it again, this time it should work for us.
>> Common Power Automate issues, isn't it?
>> What?
Why do I need to refresh this connection?
>> Maybe.
>> Um, I'll just click on that again. And that basically refreshes that hopefully. I wasn't expecting that. Yeah. So, I mean, that's it's always these kind of weird experiences that if you don't know how to deal with it, then this could be a massive problem for you. I'm really happy that we've actually stumbled upon this. So, essentially, I didn't have access to the connection. Josh had the connection because he created the flow.
I'm wanting to add it to the code app.
Josh made me the co-owner of the flow. I created a connection, swapped the connection reference over to my own connection, but then it still wasn't working in VS Code in the terminal because it hadn't refreshed. So, I went into the Power um platform uh tools extension, which is also basically the the pack CLI. You can refresh the pack CLI instead. I just connected to the environment again just to refresh that connection. And then it recognized that I did actually have a connection and the flow was added successfully. So, wow.
Josh, what do you think about that?
>> Fun. Yeah, it's I think if you're if you're in the world of per platform as maybe familiar, we've all stumbled across it. If you're new, then yeah, it's it's a big roadblock that that we've come up. So, um maybe a good thing that we've kind of stumbled across this for code apps and hopefully it saves someone some time if they ever stumbled across it. But yeah, it would be nice if it was a bit more cohesive of an experience when dealing with connections and connection references. It still feels very clunky.
>> Yeah, it does. Definitely something that can be improved by Microsoft. So, we've got some changes that we can see. We had committed this repository to a GitHub repository so we would know when things were going to change. We can see that some files have been modified where they have the M and then some have been added where they've got the U, so they're unttracked. And we can then go and look at like what has actually changed. So, we already had some data versse tables in here. We can see those listed. But in our data sources info Typescript file, we've now got this email when an item is assigned, which is our flow. And so this is just containing some metadata or the schema around our flow. So as you can see here, we've got things like parameters that are needed. So yeah, I'm looking pretty good so far. And then we've also in the schemas got this new logic flows folder. And then in here we have a new file that's not tracked. And then this goes into more detail as to the schema for the flow. So yeah, again talking about the same kinds of things like you have an input and then the connection ID, that kind of thing. And then if we look a bit further down in our source folder in the generated folder, so again this is so similar to if we were adding database tables. It's the same concept. We've got some generated files here as well. So we've got our model that's been generated and this is essentially just saying these are the parameters that you'll pass in.
So we're passing in an email that's a string and text that's a string. And then we've also got the service which is basically the different actions that you can perform with it. Um, which is basically just that you can run it. Of course, the action is you run a flow.
There's not really much more to it than that. So, we've got all of our infrastructure ready. So, we can actually now start to use this flow in our code app. So, Josh, how do you reckon we should actually wire this up?
Like, how can we talk to AI to make the magic happen? So in my mind, I would want to be feeding AI the reference material so it doesn't get confused. So we should definitely look at doing that.
And then we just ask it to say something like, you know, we want to send an email using this flow when an item is assigned to someone and see if it does it. Would you agree?
>> I think it's worthwhile trying that out.
So let's have a look. We've got this step three, call the flow from your app.
So this is actually what we want. So what you're saying is why don't we just copy the URL for that and then we go back into VS Code and then we provide that documentation and then we tell the agent here's the documentation for adding a flow and calling it from our app. We've added the flow can you call it?
>> And as a side note, can you do this with the plugin yet?
>> No. No.
>> Unless they've updated it really recently. No.
>> Fingers crossed we'll maybe see that filter through as these new and improved features uh rip down into into code apps. Yeah, exactly. So, I'd like to um trigger a power automate flow from this code. Uh I have already added the flow.
Please can you create code for the integration? The email should be triggered when an asset is updated is updated. Assigned to send an email to the person the asset has been assigned to. And then one of the things I love to do when I'm doing this kind of prompting is at the end of it to say uh if you have any questions, please let me know. That kind of thing, something like that is quite a nice one.
If anything is ambiguous or unclear, please ask me about it. And we could of course put this into plan mode and we could do all of this in a way more robust manner, but we're just trying to get a result right now. We're not really caring too much about the quality of the code that's written and things like that. You could go to the nth degree with it, couldn't you, if you really wanted, but you don't always need to do that. Not for some things. So, yeah, we should hopefully see this work fairly well. At least that's the hope.
It's always a fingers crossed moment.
And of course, because this is new technology, like as you're saying, Josh, we would want this to be put into the plug-in at some point because AI wasn't trained on this information. It has no idea how this actually works. We're trying to help it by giving it access to the documentation, but there's no guarantee that it's going to know what to do. So, it's the kind of thing that when you're doing it for the first time, if it does fail, fix your instructions.
Make sure that you tell it what to avoid doing wrong the next time. So, it's asking us some questions. It has a clear picture of the setup, knows about the flow, knows that it needs the two inputs, but it's asking us when exactly should the email fire. So, should it be every update to an assigned asset or only when the assigne changes? Well, it should be only when the assigne changes, right?
>> Yeah.
>> So, let's ask it that. Let's say, yeah, 1B. Let's give it a challenge there.
What should the text body contain? Um, we're not providing the text body, are we? So, maybe it's got a bit confused on this one. So, I'll say the text is the item ID, not the body of the email.
So that's one where this generated schema that's coming from the Power Apps service or Power Apps package is perhaps not quite the right kind of schema for it. It's coming through as text, but really it it shouldn't be text. It should be item ID. So maybe that's a place where it can be improved by Microsoft. We also have some more questions. So if the asset has no assigne, so then we say skip. And then failure handling is a great one. This is something that can so quickly and easily be overlooked. So if the flow call fails, then what should happen? So should it surface an error to the user and block the save?
>> Yeah, it's recommending B, but I would I would probably say A is a better option here personally. I'd want to know email couldn't send.
>> Yeah, I I prefer a combination of the two. So I'd say surface the error, but still let it save, I think, would make sense.
>> Yeah, >> but yeah, I mean, let's go for a just so that if there is an error, we can actually see it. But in the actual production version, you'd really want to think long and hard about what kind of experience you truly want.
>> A good lesson in not just blindly going for AI says, right? So yeah, important to read through the suggestions, make sure it is actually right.
>> Yeah, AI doesn't always know best, does it? But lots of the time it does.
So what it's doing now is of course it understands the whole situation. It asked us some questions because we said please don't let there be any ambiguity.
And now it's basically wiring things up.
So it's going into a notification API and then it's wiring up that notification. It's handling the save where it needs to change things. And um it asked us for permission to do that.
It's now asking us for permission to run some PowerShell. So this is just npm run build which I'm happy to allow for the project. So whenever it wants to build it, I'm happy for it to build it. And why would it build it in the first place? Well, it's going to want to build it to check that it does build accurately. If there's an error that happens from the build, it will come back and it will fix that. But it says the build was clean and it's then giving us a summary of what was changed. So that all looks great and it just says one note on behavior number four, which is where there's the failure. U the data vers update create runs before the flow call. So it's not going to be able to understand uh to to deal with that.
Essentially, it's going to be saved or updated and then the flow call happens.
So if the flow call fails, it can't go back and reverse that. it's not fully transactional. So when it comes to the architecture side of all of these things, that's something where you really want to consider it as well, isn't it? Like should I do it after that or should I do it before that? But then if you're creating a record, you don't have the item ID anyway. So yeah, some interesting things going on there.
>> Should we see if it works?
>> Yeah, I'm excited to see what happens next. So we'll go back into the browser.
We've got the app open here. So just a very quick basic introduction to this.
So this is our asset register. So, we've got a list of assets. So, like a laptop, a monitor, that kind of thing. And they're assigned to various people. Um, some of the names are a bit weird. Let's um maybe open up this monitor that's assigned to humongous. And we will click on We can click on edit or reassign. It doesn't really matter. I'll click on reassign. Josh, I really want to give you this monitor because I think you're going to enjoy this one. So, I'll change it to you and then I'll click on save changes and then we'll see what happens.
So the first thing I notice is that it tried to save and the modal dis didn't disappear and we didn't get a message.
So my assumption from something like that is hey maybe something went wrong with that. So let's open up our browser dev tools and then let's click on save changes again. And then we've got this batch that goes through. Uh it actually came back with a 200. So maybe everything is fine. Maybe we didn't actually implement any nice way of um saying that something's saved or updated. Maybe that's actually on me when I built this app.
>> Yeah, certainly no, you know, in my inbox anyway.
>> Okay, so of course the first thing that we do when this kind of thing happens is we go, well, this came from a Power Automate flow. Let's have a look at the flow and see did we actually trigger it in the first place and it still says your flow hasn't been run yet.
>> Did we run and deploy the app after building it? After implementing the feature, >> we didn't push the app to the environment. However, it should still call the flow. It shouldn't be a problem. We should be able to test that.
But do you know what? You've just made me think of something that we didn't do.
And this is just is something that I should have always known to do cuz I always tell people about this. But I already had this open and its connections won't get updated unless I refresh it. So, this is on me, Josh.
Sorry about that. I will get that monitor deployed to you ASAP.
So, it's loading our assets. So, yeah, we got this assigned to you. So, I'm sorry you didn't get that email, but as an apology, I'm going to send you a laptop.
I've got this really cool MacBook Air 13in that's currently assigned to me.
I'm going to give that to you as an apology. So, let's reassign that to you.
So, I'll save changes >> and then we'll see whether we get any interaction there. So, yeah, it disappears this time. The screen refreshes. It says that it's now with you. Says that it's assigned to you up here.
>> Yep. And it looks good. What I'll do is I'll share my screen and we'll see the email that's come through. Yeah. Over to uh my emails and yeah, I can see an email from you saying that an asset item has been assigned. Uh it's also pulled through the ID of the item which I don't know what that is. We we obviously have seen what it is, but I wouldn't know. We would do more transformation on that if we were doing something in production.
But really good to see that worked. And I must say that that flow triggered near instantly as soon as you hit that button. I had the email. Really good to see and it feels really performant. I'd be curious to see how good it is with longer running flows, but maybe that's more of a flow performance rather than a code app performance thing. Yeah, really good.
>> Definitely a flow performance thing. Of course, we're not asking it to respond to the code app. Um, that's something that we could test in the future as well, but this is just such a great start. I mean, we don't have to trigger flows based off of saving data in data versse or using the HTTP request now.
Instead, we can just trigger it straight from the code app. And AI had no problem wiring that up. Um, we only had a problem because of my fault if we're honest cuz I just wasn't thinking about a couple of things. But once that was sorted, it was just a breeze. It's such a beautiful integration. It's a really nice way of working.
>> Yeah, really nice. and opens the doors for a lot of customization and integration with code apps. So really good to see and yeah look forward to seeing what what's next on on the agenda for code apps. So thank you for watching the video and if you're going to try this out and or if you have tried it out we'd love to hear a bit more about it in the comments. For me now I have to rush off to the European Collaboration Summit. So it's been lovely to be with you but I really have to fly. Thanks so much everyone and see you next
Related Videos
VALORANT's Latest 'Exclusive' Tier Bundle is Rough...
KangaValorant
17K viewsβ’2026-05-28
Flight Attendant Mocks Poor Looking Black Woman β Mid Air Announcement Exposes Her Real Power
SkyboundStories-b4r
184 viewsβ’2026-05-28
I FIXED My Friendβs Blown Turbo RX-8β¦ Then Sold It
Cameron-RX8
134 viewsβ’2026-05-28
NewsWatch 12 at 5: Top Stories
NewsWatch12
1K viewsβ’2026-05-28
Simon Jordan & Danny Murphy deliver PREDICTIONS for Arsenal's Champions League FINAL with PSG
talkSPORTArsenal
6K viewsβ’2026-05-28
Botting is OUT OF CONTROL in Classic WoW (Again)...
SolheimGaming
108 viewsβ’2026-05-28
The "AI Job Apocalypse" is CANCELLED!
WesRoth
9K viewsβ’2026-05-28
STREET FIGHTER 6 - INGRID Story Walkthrough @ 4K 60αΆ α΅Λ’ β
RajmanGamingHD
12K viewsβ’2026-05-28











