Forum Discussion
Power Apps to run scheduled calls to custom connector, is it designed for this type of applications
We have created a custom connector, which do the following:-
1) Get all the accounts from external system.
2) Get the account details by passing the Ids returned from step one.
Then inside the Power App >> we need to loop through the returned account info , and do the following:-
1) If the account ID already exists inside a SharePoint list >> to update the account info inside SharePoint list.
2) If the account ID is new >> to add the account info inside SharePoint list.
This can be done, if the user will manually triggers calling the custom connector, by clicking on a button inside a Canvas App for example. But i need to create a power Apps which will allow the user to do the following scheduled task:-
1) The user will specify the Refresh rate in minutes. for example to do a call to the custom connector each 150 minutes.
2) Then power Apps will call the custom connector each 150 minutes without any user intervention >> and updates the SharePoint list accordingly
so is this something we can build using Power Apps? In other word to build something similar to Scheduled Flow inside Power Automate?
Thanks
- Micca0815Iron Contributor
john john
How about the following setup?- Context variable to specify a timer duration (reflecting the user input for scheduled refresh time)
- on timer end, trigger the Flow
- Context variable for a hidden toggle value (as trigger for the data source refresh)
- UpdateContext to false before the Flow run, set context with the Flow run (should return true by default in case the Flow run succeeded)
- onTrue of the toggle, perform any refresh within the app
- Within the Flow built two arrays of items with the same pattern of properties, one for the returned users, one for the Sharepoint items
- Then loop thru all items from the Sharepoint user array and check if the current item exists within the returned account ID array.
- if not append the user ID entry to another array for processing in a later step
- Bonus: do it the other way around as well, to figure out which SharePoint entries might be obsolete
- Then loop thru all items from the Sharepoint user array and check if the current item exists within the returned account ID array.
- With the returned array of to be added account IDs, you now can either add all entries one by one, with concurrency enabled or by building a batch request.
The performance might depend on the total amount of records to process.
You could tweak the duration slightly also, if you make use of a compose action and access its items outside of the apply to each , instead of an append to variable action within the 'loop'. - Context variable to specify a timer duration (reflecting the user input for scheduled refresh time)