cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
akg1421
Helper III
Helper III

Collection is not populated at OnStart with data from dynamics fin ops Table/Entity

App OnStart i create a collection

ClearCollect(collect_workflowworkitem,Blank());
ForAll(EntityworkflowWorkitemData As d365entity,
    Collect(collect_workflowworkitem,
        {
            FullNameOriginator: LookUp(PersonUsers, ID = d365entity.'User (Originator)','Person name'),
            Status:d365entity.Status,
            'User (Originator)':d365entity.'User (Originator)',
            Subject:d365entity.Subject,
            'Work item instructions':d365entity.'Work item instructions',
            WorkflowWorkItemClaimed:d365entity.WorkflowWorkItemClaimed,
            'User (UserId)':d365entity.'User (UserId)',
            'Due date time':d365entity.'Due date time'
        }
    )
);

 

The collection is not populated when I run app, however, in Collections headers are formed

akg1421_0-1664446959619.png

 

The data source is staging table (also known as Entity) from Dynamics365 fin ops. Where isn't the data loading? Will it take longer times to load even when App's OnStart has been called.

Please note the app starts running and the gallery control having collect_workflowworkitem as the data source shows no data

 

@RandyHayes @WarrenBelz @Drrickryp @BCBuizer @AhmedSalih @dpoggemann @timl @phipps0218 @Pstork1 @Nogueira1306 @NandiniBhagya20 @victorcp @Adriian21 @Yahya @iAm_ManCat @mdevaney @Gochix @Mira_Ghaly @poweractivate @jatcube @calvp 

6 REPLIES 6
victorcp
Solution Sage
Solution Sage

Hi,

is EntityworkflowWorkitemData a variable/collection? if so, are you setting it before run that code?

can you make sure there is information in EntityworkflowWorkitemData

@victorcp 

 

"EntityworkflowWorkitemData" is like anyother datasource (via Dynamics365finops connector). Yes it contains information under column names in database. Issue is also, after few navigations in App the data is loaded in the collection but OnStart lets screen loads without first completely loading data from my datasource.

calvp
Advocate I
Advocate I

So I noticed a similar issue in a current project.

My diagnosis is that on start continues running in the background if it has a long processing time. I personally need to fill two collections from an API through a custom connector. 

My "solution" was to put a loading animation that overlaps my start page and gets hidden at the end of on start. 

It's not the cleanest but it allows the screen to not be used before everything is ready.

Pstork1
Dual Super User
Dual Super User

Check your setting in the app for OnStart Blocking.  If that is enabled the app will load before you finish loading data from Dataverse.  But I usually find using OnStart to access data through connectors is not reliable.  Instead I would put that code in the OnVisible routine of a Splash screen that loads first in the app.  If you use the same code in a button after your app loads do you get results in the collection?  If you do then the problem is using that code in OnStart.  If you don't then something is wrong with the code itself.

image.png



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

@Pstork1 

 

App.Onstart did not work Screen.OnVisible also did not work.

 

Using Button.OnSelect loads data but takes as much time with other options. The data is loading so nothing is wrong with the code only the ootb features by powerapps seem to be unreliable.

 

Also the Settings > "Use non-blocking OnStart rule" apparently has no effect.

 

Any other way around?

Did you try Screen.OnVisible running in the client, or just in the Design web site Preview?  It won't work on the Preview because the event doesn't fire in the Preview.  It should work in the production client.  App.OnStart probably won't work for loading a large data source due to the timing of accessing the connection.  I don't know of any other workaround.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (3,862)