Hi,
When I enter a screen with the OnParametersChanged, it executes the action, but when I refresh (F5 or clicking the refresh arrow) the screen does not execute it again. Should it be triggered again, right?
Thanks in advance!
Is just triggered when an input from the block changes. When you click refresh the input parameters are all cleared and is in a reset status, when the input or inputs are changed it will trigger the OnParametersChanged
https://success.outsystems.com/documentation/11/developing_an_application/implement_application_logic/screen_and_block_lifecycle_events/
Well,
A screen doesn't have that even OnParametersChanged, WebBlocks have. And I just tried a simple scenario with a screen with a single webblock with OnParametersChanged.
This action wasn't called at all at screen start. So something in your page might be eventually changing something after the rendering of the block.
It is a matter of timing, but you can't assume that OnParametersChanged will always be called at the beginning of the life of a block. It depends on when the block comes into existence compared to when the data that go into it, become filled.
If all the data are retrieved, before the block exists / is ready, than OnParametersChanged will not be executed, if some data (like maybe a slow server action, or some logic that runs late in the screen lifecycle) is still altered right after the block begins it's life, then OnParamatersChanged will run.
In your block's logic, you should not make the assumption that it will run at least once at beginning of block.
Dorine