Power Apps to run scheduled calls to custom connector, is it designed for this type of applications

%3CLINGO-SUB%20id%3D%22lingo-sub-3214264%22%20slang%3D%22en-US%22%3EPower%20Apps%20to%20run%20scheduled%20calls%20to%20custom%20connector%2C%20is%20it%20designed%20for%20this%20type%20of%20applications%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3214264%22%20slang%3D%22en-US%22%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CP%3EWe%20have%20created%20a%20custom%20connector%2C%20which%20do%20the%20following%3A-%3C%2FP%3E%3CP%3E1)%20Get%20all%20the%20accounts%20from%20external%20system.%3C%2FP%3E%3CP%3E2)%20Get%20the%20account%20details%20by%20passing%20the%20Ids%20returned%20from%20step%20one.%3C%2FP%3E%3CP%3EThen%20inside%20the%20Power%20App%20%26gt%3B%26gt%3B%20we%20need%20to%20loop%20through%20the%20returned%20account%20info%20%2C%20and%20do%20the%20following%3A-%3C%2FP%3E%3CP%3E1)%20If%20the%20account%20ID%20already%20exists%20inside%20a%20SharePoint%20list%20%26gt%3B%26gt%3B%20to%20update%20the%20account%20info%20inside%20SharePoint%20list.%3C%2FP%3E%3CP%3E2)%20If%20the%20account%20ID%20is%20new%20%26gt%3B%26gt%3B%20to%20add%20the%20account%20info%20inside%20SharePoint%20list.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20can%20be%20done%2C%20if%20the%20user%20will%20manually%20triggers%20calling%20the%20custom%20connector%2C%20by%20clicking%20on%20a%20button%20inside%20a%20Canvas%20App%20for%20example.%20But%20i%20need%20to%20create%20a%20power%20Apps%20which%20will%20allow%20the%20user%20to%20do%20the%20following%20scheduled%20task%3A-%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1)%20The%20user%20will%20specify%20the%20Refresh%20rate%20in%20minutes.%20for%20example%20to%20do%20a%20call%20to%20the%20custom%20connector%20each%20150%20minutes.%3C%2FP%3E%3CP%3E2)%20Then%20power%20Apps%20will%20call%20the%20custom%20connector%20each%20150%20minutes%20without%20any%20user%20intervention%20%26gt%3B%26gt%3B%20and%20updates%20the%20SharePoint%20list%20accordingly%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eso%20is%20this%20something%20we%20can%20build%20using%20Power%20Apps%3F%20In%20other%20word%20to%20build%20something%20similar%20to%20Scheduled%20Flow%20inside%20Power%20Automate%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3214264%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Flow%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerApps%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3239833%22%20slang%3D%22en-US%22%3ERe%3A%20Power%20Apps%20to%20run%20scheduled%20calls%20to%20custom%20connector%2C%20is%20it%20designed%20for%20this%20type%20of%20applicati%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3239833%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F233354%22%20target%3D%22_blank%22%3E%40john%20john%3C%2FA%3E%26nbsp%3B%3CBR%20%2F%3EHow%20about%20the%20following%20setup%3F%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CUL%3E%3CLI%3EContext%20variable%20to%20specify%20a%20timer%20duration%20(reflecting%20the%20user%20input%20for%20scheduled%20refresh%20time)%3CUL%3E%3CLI%3Eon%20timer%20end%2C%20trigger%20the%20Flow%3C%2FLI%3E%3C%2FUL%3E%3C%2FLI%3E%3CLI%3EContext%20variable%20for%20a%20hidden%20toggle%20value%20(as%20trigger%20for%20the%20data%20source%20refresh)%3CUL%3E%3CLI%3EUpdateContext%20to%20false%20before%20the%20Flow%20run%2C%20set%20context%20with%20the%20Flow%20run%20(should%20return%20true%20by%20default%20in%20case%20the%20Flow%20run%20succeeded)%3C%2FLI%3E%3CLI%3EonTrue%20of%20the%20toggle%2C%20perform%20any%20refresh%20within%20the%20app%3C%2FLI%3E%3C%2FUL%3E%3C%2FLI%3E%3CLI%3EWithin%20the%20Flow%20built%20two%20arrays%20of%20items%20with%20the%20same%20pattern%20of%20properties%2C%20one%20for%20the%20returned%20users%2C%20one%20for%20the%20Sharepoint%20items%3CUL%3E%3CLI%3EThen%20loop%20thru%20all%20items%20from%20the%20Sharepoint%20user%20array%20and%20check%20if%20the%20current%20item%20exists%20within%20the%20returned%20account%20ID%20array.%3CUL%3E%3CLI%3Eif%20not%20append%20the%20user%20ID%20entry%20to%20another%20array%20for%20processing%20in%20a%20later%20step%3C%2FLI%3E%3C%2FUL%3E%3C%2FLI%3E%3CLI%3E%3CEM%3EBonus%3C%2FEM%3E%3A%20do%20it%20the%20other%20way%20around%20as%20well%2C%20to%20figure%20out%20which%20SharePoint%20entries%20might%20be%20obsolete%3C%2FLI%3E%3C%2FUL%3E%3C%2FLI%3E%3CLI%3EWith%20the%20returned%20array%20of%20to%20be%20added%20account%20IDs%2C%20you%20now%20can%20either%20add%20all%20entries%20one%20by%20one%2C%20with%20concurrency%20enabled%20or%20by%20building%20a%20batch%20request.%3C%2FLI%3E%3C%2FUL%3E%3CP%3EThe%20performance%20might%20depend%20on%20the%20total%20amount%20of%20records%20to%20process.%3CBR%20%2F%3EYou%20could%20tweak%20the%20duration%20slightly%20also%2C%20if%20you%20make%20use%20of%20a%20compose%20action%20and%20access%20its%20items%20outside%20of%20the%20apply%20to%20each%20%2C%20instead%20of%20an%20append%20to%20variable%20action%20within%20the%20'loop'.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Valued Contributor

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

1 Reply

@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
  • 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'.