Is there something like preparation in mobile app ?

I have a "Fetch data from other sources" action that get's the user role to customize widget visibility but there's a delay between when the screen loads and when this action runs, 

I want something that completely runs before rendering the screen

Hi Muhamed,

First of all there is no preparation in mobile applications. There are few life cycle events which you can use life OnInitalize, onReady, OnRender only. For more information please refer : 

https://success.outsystems.com/Documentation/11/Developing_an_Application/Implement_Application_Logic/Screen_and_Block_Lifecycle_Events

Thanks


Solution

HI Muhamed,

As you are using fetch data from other sources so you can add on after fetch action on it. This event gets called just after data is fetched so this is the perfact place for the work you want to do.

Just select action you have created using fetch data from other source and in its property you will see an option to create on after fetch event for it.

Solution

vikas sharma wrote:

Hi Muhamed,

First of all there is no preparation in mobile applications. There are few life cycle events which you can use life OnInitalize, onReady, OnRender only. For more information please refer : 

https://success.outsystems.com/Documentation/11/Developing_an_Application/Implement_Application_Logic/Screen_and_Block_Lifecycle_Events

Thanks


All of these can use only client action not server actions, all i want to do is to set specific widget visible depending on role so i'm calling a "Fetch data from other sources" action, it can't be called on onready event or onrender


Hi Muhamed,

in addition to what Vikas said, you can use the event handler OnInitialize.
You should read this post: Server Actions on Initializing a Screen.

Cheers,

Nuno Verdasca



Muhamed, you can still define an action to be called after data is retrieved: Go to the DataAction and on Events pick "On After Fetch."

Just make the default behavior to hide the section and if the user, later on, is recognized as having access, you show it.

Hi Muhamed,

If its all on the basis of user's role then you can find the role in previous screen of application and then use here directly. 


Muhamed Akl wrote:

vikas sharma wrote:

Hi Muhamed,

First of all there is no preparation in mobile applications. There are few life cycle events which you can use life OnInitalize, onReady, OnRender only. For more information please refer : 

https://success.outsystems.com/Documentation/11/Developing_an_Application/Implement_Application_Logic/Screen_and_Block_Lifecycle_Events

Thanks


All of these can use only client action not server actions, all i want to do is to set specific widget visible depending on role so i'm calling a "Fetch data from other sources" action, it can't be called on onready event or onrender


Hi Muhamed Akl,

As stated above, you can use the "Fetch data from other sources" to understand if the user has the role (since it runs on server side). 

After that, you enclose your UI widget inside of a If widget. When the result comes out off the "Fetch data from other sources" you update the variable which controls the visibility of the widget in the "On After Fetch" event.

You can also set thedefault value for the variable to false to prevent widget flickering.

Cheers,

António Pereira

Nikhil Gaur wrote:

HI Muhamed,

As you are using fetch data from other sources so you can add on after fetch action on it. This event gets called just after data is fetched so this is the perfact place for the work you want to do.

Just select action you have created using fetch data from other source and in its property you will see an option to create on after fetch event for it.

Thank you Nikhil


Nuno Miguel Verdasca wrote:

Hi Muhamed,

in addition to what Vikas said, you can use the event handler OnInitialize.
You should read this post: Server Actions on Initializing a Screen.

Cheers,

Nuno Verdasca



Thank you Nuno


Nuno Reis wrote:

Muhamed, you can still define an action to be called after data is retrieved: Go to the DataAction and on Events pick "On After Fetch."

Just make the default behavior to hide the section and if the user, later on, is recognized as having access, you show it.

Thank you Nuno


vikas sharma wrote:

Hi Muhamed,

If its all on the basis of user's role then you can find the role in previous screen of application and then use here directly. 


Thank you Vikas