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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Have a Button run a fl...
Power Apps
Answered

Have a Button run a flow connected with a Sharepoint list ID

(0) ShareShare
ReportReport
Posted on by 818

For my Sharepoint list form I want that when you press a button it starts a flow that starts an approval request for that item. Problem is, I'm having trouble configuring the Flow so that it knows that it has to send it in that Selected Item and that way I can configure the Flow with the necessary ID.

Categories:
I have the same question (0)
  • Sickle-Cell Profile Picture
    600 Super User 2024 Season 1 on at

    Hi @WorkingRicardo,

     

    Can you post some screenshots of what you have so far so I can understand your use case a little more?

  • WorkingRicardo Profile Picture
    818 on at

    I mean so far I have nothing practically xD Because to do things I needs to extract somehow the ID of the item the user has selected through the Sharepoint List. But what I have is this, the button, and the OnSelect is to Run the Flow, which the flow is at early stages. I just need to know how to make sure PowerAutomate knows I'm on item with ID 15 for example. 

     

    ChatGPT told me to use the Patch function to update a hidden column in Sharepoint list so that way it knows is on item 15, but i couldn't get the two formulas to work on the same OnSelect property of the ButtonButton.PNGSharepoint.PNG

  • WorkingRicardo Profile Picture
    818 on at

    I mean so far I have nothing practically xD Because to do things I needs to extract somehow the ID of the item the user has selected through the Sharepoint List. But what I have is this, the button, and the OnSelect is to Run the Flow, which the flow is at early stages. I just need to know how to make sure PowerAutomate knows I'm on item with ID 15 for example. 

     

    ChatGPT told me to use the Patch function to update a hidden column in Sharepoint list so that way it knows is on item 15, but i couldn't get the two formulas to work on the same OnSelect property of the ButtonButton.PNGSharepoint.PNG

  • Sickle-Cell Profile Picture
    600 Super User 2024 Season 1 on at

    Hi @WorkingRicardo,

     

    Yeah, the easiest way would be to have a master ID column on your Sharepoint list that can be pulled through to an invisible element in the form, which you can then pass over to Power Automate. 

     

    if you were looking to go down the Patch route it would look something like this :-

     

    Patch(
     SharepointListName,
     Defaults(SharepointListName),//If new
     Lookup(SharepointListName,ID=IDName.Value, ID) //If existing
     {ID: IDName.Value}
    );
    
    PruebaPowerApp.Run();
  • WorkingRicardo Profile Picture
    818 on at

    Mmm ok! The ID column already exists, it is the one auto-created by Sharepoint. Considering that, what do I next? I changed my code to fit the exact names on my App, but I feel IDName remains to be changed but dunno to what

    Patch(
     Incidencias;
     Defaults(Incidencias);
     {ID: IDName.Value});
    PruebaPowerApp.Run();

    The extra ";" are not error, my PowerApps for some reason only takes that as a separator instead of ","

  • Sickle-Cell Profile Picture
    600 Super User 2024 Season 1 on at

    Hi @WorkingRicardo,

     

    Ah, excellent, that column will do. IDName will need to be changed to the element that holds the value of the ID list you're pulling through from your app. If you don't have one within your form, then add that in. It can be hidden so end-users can't see or edit it as they won't have to. 

    If this will only be submitting new records, then you can sub out the IDName part with a piece of code to look up the highest value ID already in the list and adding one, but I'm not sure if this form is purely to submit new forms or not. 


  • WorkingRicardo Profile Picture
    818 on at

    @Sickle-Cell Thanks for such quick replies.

    But apologies, I did not understood most of what you said xD... I'm a newbie at all of this still.

    Mmm I mean the ID column exist, and when I've needed to use that through PowerApps just writing ID was enough (Selected.ID; or SelectedListItemID). 

     

    This would not be for creating new entries in the list, as a separate button that has Submit(SharepointForm1) already exists. This button will exist for running a flow that will start an approval Flow, so that's why I need to know the current item ID. (on my image I'm sending an email to myself to see if it even works, but of course it doesn't :()

  • Sickle-Cell Profile Picture
    600 Super User 2024 Season 1 on at

    Hi @WorkingRicardo,

     

    No bother, if there is anything you don't understand, let me know and I can try and expand my explanation 😁

    If this is just for updating existing records, then, try this, replacing the IDName with the code you've already worked with.

    Patch(
     Incidencias;
     Defaults(Incidencias);
     {ID: Selected.ID});
    PruebaPowerApp.Run();

     

    Truthfully, if you're looking to pass this to PowerApps, the more I'm thinking about it, the less likely I'd be to use this idea. Are you using the PowerAppsV2 trigger in Power Automate? If so, you can add in a variable to pass over from PowerApps and then just use the code PruebaPowerApp.Run(Selected.ID); to ensure Power Automate knows which record to update when it's done. 

  • WorkingRicardo Profile Picture
    818 on at

    @Sickle-Cell Thanks again 😄

    Noo, this button isn't for updating anything in the Sharepoint List, it's just to start the PowerAutomate flow that will crate an approval flow for that item.

     

    Yes! I'm using the PowerAppsV2 trigger. Mmm I kinda get the part of the variable part as I saw it in a video tutorial, they created a String (cadena) variable that housed in its Value (Valor) a dynamic content from the PowerApps, but I only have Cuerpo (body) to add, and that did nothing. String varaible.PNG

     

    So what I'm lacking here?

    Regarding the "PruebaPowerApp.Run(Selected.ID)" part, where would this code go?

  • Sickle-Cell Profile Picture
    600 Super User 2024 Season 1 on at

    Hi @WorkingRicardo,

     

    Okay, so in Power Automate, go up to the V2 Power Apps trigger, click Add an Input and choose text. Then give it a name (such as ID), and leave everything else as it is. Then you can use that name in Power Automate to tell whatever steps you need what ID you're trying to update.

     

    Then you return to PowerApps and locate the run code, on the OnSelect of your button. Then you can expand the run code to include passing over the ID variable by using PruebaPowerApp.Run(Selected.ID), which should hopefully work, if not you can try PruebaPowerApp.Run(SelectedListItemID). 

     

    Does that all make sense? That should pass over your ID variable into Power Automate and allow that to work from there 😀

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard