Navigating to a new screen programatically
Application Type
Reactive

Hi all

Is there a way to navigate to another screen when you don't know which screen will be selected before hand?


I want to have a menu of all screens that a user can select from but I don't want it to be hardcoded as then I have to maintain  it.

I have a lists of screens (currently hardcoded but also wondering if I can find that somewhere in OS already - see later question) and the user can select one, but I don't want to have a Switch to match what they selected with an existing screen as there could be a lot of screens and I don't want to have to maintain it, I want to have some sort of logic which is able to take the link selected (probably with the screen name in it) and then just navigate to that. I would try the external link option but I know OS has some clever ways of optimizing transitions between screens and I don't want to lose that...

Any ideas? Also, is there a list somewhere that I can access of all of the available screens within an app or do I have to create a static entity for that? Maybe there is a component that exists for this also?

Thanks

Solution

Hi, there are several ways you can achieve this. 

https://www.outsystems.com/forge/component-overview/159/outdoc

This official component can return a list of screens present in your application by reading the metadata of your module. You could use this to "generate" the URL where the user will be headed next.


 What you also could do is make a static entity for the menu items, and on click, create a function with a Switch statement that navigates to the correct screen based on the static entity. 


Hi @Bas de Jong 

Thanks for replying on this. I will give that component a look. I think the static entity might work better as I imagine the optimization of the screen lifecycle will be lost when navigating to a new URL rather than using the build in screen drop and drag functionality. Just a pity then that it has to be maintained... seems like a catch 22.

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