On render executes too many times

I have a screen with an 'On Render' event where an external JavaScript file is executed.

On this screen I have 7 total aggregates. If I understand correctly, I believe the onRender action should be executed 8 times, after the fetching of each of the aggregates. The problem is, it's executed many, many more times than that. I didn't count, but I'd guess more than 30. This effects the execution of my JavaScript code.

Is there a way to have my JS code execute on the first loading of the page - only after ALL the aggregates are fetched and then on any data change? Thank you in advance. Sorry if I have misunderstood the OnRender action, working with Lifecycle stages is very new to me and despite reading about it and following the courses it is still slightly unclear.

If you want to run Js after fetching data from aggregates then I think you should call in the onAfterFetch of the aggregate. But as you have multiple aggregates so either can put them all in a data action or in the on afterfetch of first aggregate call other aggregates and then in on Afterfetch of last aggregate call Js.


Hello @Jana Smith,

For this problem you can create one action(contains us logic, js, etc.) in screen and assign same action to "OnAfterFetch" of all aggregates and also same action call in "OnInitialize" of screen. 


Another way is same as mentioned by @Vikas Sharma you can create on data action for that screen call all aggregates in that and call you js in "OnAfterFetch" action of that Data action.


Narendra Bhangale.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.