
Announcements
So I have been trying to associate a flow with a button on power apps; employees email out their weekly entries to their respective manager. The thing is that their are several managers that will view and approve on an individuals weekly timesheet. So how to integrate a flow with a button, which could include the start and stop dates I want to process, then have the flow do a get items on the list to get all the entries which would be in bulks as I'm trying to gather weekly entries, Then use filters and loops to process the records and send the approvals.
Hi @Anonymous ,
Based on the needs that you mentioned, I think the combination of PowerApps and Power Automate could achieve your needs.
If you want to pass the start and stop dates from canvas app to your flow, you must define these parameters (which you want to pass from canvas app to flow) within your flow using "Ask in PowerApps" dynamic content of PowerApps trigger button.
Then within your flow, you could use the passed start and stop dates value to filter these items from your data source (e.g. a SP List) through "Filter array" action.
I have made a test on my side, please take a try with the following workaround:
Flow's configuration as below:
Within the "Filter array" action, "From" field set to value dynamic content of the "Get items" action. click "Edit in advanced mode", type the following expression:
@and(greaterOrEquals(ticks(item()?['Created']), ticks(outputs('StartDate'))), lessOrEquals(ticks(item()?['Created']), ticks(outputs('EndDate'))))
After that, you could add a "Apply to each" action below the "Filter array" action to loop your following process.
App's configuration:
Add above flow connection into your app, then set the OnSelect property of the "Fire Flow" button to following:
'FlowName'.Run(StartDatePicker.SelectedDate, EndDatePicker.SelectedDate)
More details about firing a flow from a canvas app, please check the following article or video:
https://www.youtube.com/watch?v=1wl9AtxWdkg
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/using-logic-flows
Best regards,