top of page

Passing List IDs from SharePoint to PowerAutomate via PowerApps

A common request from customers using Microsoft 365 is the implementation of Review and Approval Processes across a variety of SharePoint Lists, e.g., Training Requests, Holiday Requests and so on.

These are often modelled using the SharePoint list to hold the requests, a PowerApps Form on top of the list to make it 'look pretty', and a PowerAutomate (Flow) to drive the Approval Process itself.

You often end up with buttons similar to the below at the bottom of your PowerApps form:

... the "Submit Request for Approval" button typically makes a call onto a PowerAutomate (Flow), passing in the List ID of the current item in SharePoint so the PowerAutomate knows which item it needs to process.

This can be actually surprisingly tricky to implement robustly, as your "Submit Request for Approval" button (which is a button on a PowerApps Form) needs to deal with a variety of situations, e.g.,:

  • New Requests (NewForm.aspx) - No SharePoint List Item ID yet

  • Existing Requests currently being edited (EditForm.aspx) - Happy Path - you have a SharePoint List Item ID

  • Existing Requests currently being viewed (DispForm.aspx) - Form is in DisplayMode

  • Existing Requests launched from outside the SharePoint list - e.g., from emailed links. - Form launches in DisplayMode, but the standard Submit process in this context can prevent successful calls onto PowerAutomate due to timing issues.

The below technique is what I use to deal with these various scenarios robustly.

In the "OnSelect" property of the "Submit Request for Approval" button, add the following code:

// If Form Mode is View, put it into edit Mode

If(SharePointForm1.Mode=FormMode.View ,EditForm(SharePointForm1),false);

// Submit the Form - to ensure the item has an ID (note - the OnSuccess Event of the form should not Reset the form or RequestHide - this is done below)


// Store off the item ID in a Variable


// Make the call to the Power Automate, passing in the item ID as a parameter


// Reset the Form


// Hide the form


Note - for the above to work successfully, make sure you remove the ResetForm and RequestHide calls from the "OnSuccess" Action of your SharePoint form; I actually replace them with a call to store off the "LastSubmit.ID" as shown below.

Fiddly, techie, probably a "belt and braces" approach, but it works!

Any queries, let me know via the Contact page on this site.

758 views0 comments


Otagem Logo Wider.png
bottom of page