I just got back from Ignite 2019 and I asked one of the experts if I could do this and he said he thought it was possible. I've not been able to figure it out in the past three days. It may sound crazy, but I would like to refresh the data-source in my app only if a new item is added to my SharePoint Event List. Cache build-up from constant refresh to check for new items is crashing the iPad. I tried to use Flow to create a "When new item is created" and then use "Respond back to PowerApps", but that seems to form some kind of reoccurring loop. The "Respond back to PowerApps" must only work if the Flow is called from PowerApps.
At this point I'm just reaching out to see if this is possible and if not, I can just move on to another solution.
Solved! Go to Solution.
The loop will be in flow, I think you need to create three loops in order to meet your goals.
Basic design of the flow:
trigger from powerapps --> [Loop: Apply to each]Find the last row of the Sp list and get its ID# and set this as variable1--> Do a loop until (condition for 1 day for testing, 30days is the max)->Inside the loop-> create a 10 mins delay-> Find the last row of the Sp list and get its ID# , do a compare of this ID# to variable1_> if ID# greater than variable1, send back a powerapps variable and set it to true, else do nothing -> go back to the do until loop again
Link for find the last ID (last row) of the sharepoint list, you also need to change the default for 100 items to 5000 max when scan thru the sp list in the setting of the apply to each loop.
Here is a sample to set variable from powerapps->flow->powerapps
Hope this help.
The Respond to PowerApps action will only be executed if you trigger the flow from the same canvas app. I do not think this is doable directly.
As a workaround for this, you can create a timer control with below configuration:
App -> OnStart -> Set(RowCountOnLoad,CountRows(DataSourceName))
AutoStart -> true
Duration -> 10000 (runs every 10 seconds, you can update this.)
Visible -> false
repeat -> true
autopause -> true
OnTimerStart -> If(CountRows(DataSourceName) > RowCountOnLoad, Refresh(DataSourceName);Set(RowCountOnLoad,CountRows(DataSourceName)))
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
That's ingenious and simple. I'll put that together and test it. I'll respond back and let you know the outcome. Thank you for the suggestion.
So it appears that the countrows only counts what is cached. You have to refresh the data source to change the countrow total. This defeats the purpose. It works at the app if someone add an event because the submit form will refresh the data. If you add the event in the Sharepoint calendar, you can't see it until you refresh and doing that every minute or two is killing the iPad.
Hi @dakridge ,
Could you please share a bit more about your scenario?
Do you want to refresh SP List data source in your app when a new item is created in SP Event List?
If you want to refresh SP List data source in your app when a new item is created in SP Event List, I afraid that there is no way to achieve your needs in PowerApps currently.
Power Automate (MS Flow) could not achieve your needs. Currently, we could only fire a flow from an app, could not fire an Event in an app from a flow.
As an alternative solution, I think the Timer control could achieve your needs. You could consider add a Timer control in your app to refresh your SP List data source every second.
I have made a test on my side, please take a try with the following workaround:
Add a Timer control in your app, set the Duration property to following:
set the AutoStart property and Repeat property to following:
set the OnTimerEnd property to following:
set the Visible property of Timer control to following:
false // Hidd the Timer control
Please consider take a try with above solution, check if the issue is solved.
That's exactly what I am doing currently in the app. If you look back in my original entry, the constant refresh of the SP List is causing cache buildup on the iPad of over 6gb within a two week period. I have to take the app offline and use the menu on the manual clear in the PowerApps app menu and start it over again. This is going on 2 years and can't get a solution or see that anyone else is having an issue.
I see multiple solutions using the timer, but if you setup a simple gallery using a SP Event List calendar and set a time to refresh the data every 10 seconds. You will see the build-up of cache in the iPad. Once full, it crashes. I really only want to refresh when something is added either in SP or at the app.
There seems to be no solution. Everything points back to Refresh(DataSource).
I recall you can trigger a flow directly from powerapps, do something and then it can push a value back to powerapps.
Create a check box called "Auto Update", oncheck it will trigger a flow which do a loop of every 5 mins to check sharepoint list ID is greater than initial ID it stored. If greater, update the powerapps field called "NewItem" = true. Set the flow initial to last ID value. and do the loop again.
In the powerapps, set another 5mins timer to check "NewItem" if true, if true, refresh the sharepoint list and set the NewItem = false. This will prevent too many sharepoint list refresh if it really works.
Sorry I didn't test it myself.
Thank you for your reply. I'm a little confused on what the SharePoint List ID is and how that is used to check the if a new item is added to the list. I'm going to do a little research and see if I can find a little more info while I wait for your response.
Thanks again for your reply.
Treat the sharepoint list ID like helpdesk ticket number, it is auto increment and cannot be reset or change. If you go to the sharepoint website where the list located, go to view/hide column, check to view the ID column.
I'm getting closer to understanding. I have the ID setup now. Is the loop you propose to use in Flow? Is this the Do Until? I see there is limitation to like a 24hr period on the loop.
Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.
Fill out a quick form to claim your user group badge now!
Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities
Features releasing from October 2019 through March 2020
Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.
Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications