24
Views
9
Comments
Solved
Getting Module Name from Screen Name for JS Navigation
Question
Application Type
Reactive

Hey everyone!

I'm working on a bit of a tricky navigation requirement and would appreciate some input from the community.

Here's the setup and what I'm trying to achieve:

  1. I need to perform a screen transition using JavaScript because the requirement is to open the destination screen in a new browser tab. (I know this isn't the standard OutSystems way, but it's a fixed customer requirement, so I'm running with the JS approach for now!)

  2. To make this work, I need to dynamically construct the full URL for the target screen.

The challenge is reliably getting the Module Name to form that URL, given only the Screen Name.

My main question is this:

Is there a reliable and robust way to get the Module Name of a target screen, given its ScreenName (or Screen object), without resorting to using Site Properties?

I want to avoid Site Properties because I need to be absolutely certain I'm getting the correct, current Module Name at runtime, especially if the screen gets refactored or moved to a different module in the future. I'm looking for a method that OutSystems would inherently ensure is correct.

Something that translates:

TargetScreenName $\rightarrow$ TargetModuleName (e.g., ProductsDetail $\rightarrow$ CoreManagement)

Any creative solutions or built-in functions I might be overlooking? Thanks in advance for any help!

Happy coding!

2025-12-22 13-50-43
Sherif El-Habibi
Champion
Solution

Hello @Narumi Ganaha,

The only issue here is that you’re given the screen, and from it, you need to determine the module. The only method I’ve found to do this is by accessing the OSSYS_ESPACE_SCREEN system table which, unfortunately, isn’t accessible.

Any other approach I’ve explored still involves some level of static configuration. For example, if you generate the URL manually, you still need to know the module name associated with the screen. And even if you retrieve the module from the Espace table, you don’t get the screen name meaning you’d still have to define it statically.

The only workaround I’ve found is to use a Link element and set its Target attribute to _blank. Of course, this requires referencing the screen from the other module, which creates a weak reference, meaning any changes to that screen will be immediately reflected.

UserImage.jpg
Narumi Ganaha

Hi @Sherif El-Habibi ,

First of all, I’m very sorry for the late reply! I've been away from this thread for a while.

Regarding the Link element with target="_blank", I agree it is the standard and best way to open a new tab. However, due to strict project requirements, I am mandated to handle the navigation via JavaScript logic, so unfortunately, I cannot use the standard Link widget approach this time.

That said, I really want to thank you for exploring multiple approaches, including the system tables. Your deep technical insight into the platform's limitations and why dynamic mapping is difficult was extremely valuable. It helped me clearly understand what is and isn't possible in this context.

Thanks again for your time and detailed analysis!

2025-12-22 13-50-43
Sherif El-Habibi
Champion

No worries at all, you’re welcome anytime.

2025-12-03 17-22-41
Lavanya Kamalaguru

Hi @Narumi Ganaha,

To get the module name of the screen, there is an in-built function existing in Outsystems.

GetEntryEspaceName() is a built-in OutSystems function used to retrieve the name of the module (eSpace) where the currently executing screen or logic resides. 


UserImage.jpg
Narumi Ganaha

@Lavanya Kamalaguru 

First of all, I’m very sorry for the late reply! I've been away from this thread for a while.

Thank you for the suggestion. I’m familiar with GetEntryEspaceName(), but as I understand it, that function returns the name of the current module where the logic is running.

In my case, I need to get the name of a different module (the Producer module) from the Consumer side. Since the target screen is in another module, I don't think this function will give me the module name I need.

I appreciate you taking the time to help me, though!

2025-12-22 13-50-43
Sherif El-Habibi
Champion
Solution

Hello @Narumi Ganaha,

The only issue here is that you’re given the screen, and from it, you need to determine the module. The only method I’ve found to do this is by accessing the OSSYS_ESPACE_SCREEN system table which, unfortunately, isn’t accessible.

Any other approach I’ve explored still involves some level of static configuration. For example, if you generate the URL manually, you still need to know the module name associated with the screen. And even if you retrieve the module from the Espace table, you don’t get the screen name meaning you’d still have to define it statically.

The only workaround I’ve found is to use a Link element and set its Target attribute to _blank. Of course, this requires referencing the screen from the other module, which creates a weak reference, meaning any changes to that screen will be immediately reflected.

UserImage.jpg
Narumi Ganaha

Hi @Sherif El-Habibi ,

First of all, I’m very sorry for the late reply! I've been away from this thread for a while.

Regarding the Link element with target="_blank", I agree it is the standard and best way to open a new tab. However, due to strict project requirements, I am mandated to handle the navigation via JavaScript logic, so unfortunately, I cannot use the standard Link widget approach this time.

That said, I really want to thank you for exploring multiple approaches, including the system tables. Your deep technical insight into the platform's limitations and why dynamic mapping is difficult was extremely valuable. It helped me clearly understand what is and isn't possible in this context.

Thanks again for your time and detailed analysis!

2025-12-22 13-50-43
Sherif El-Habibi
Champion

No worries at all, you’re welcome anytime.

2024-01-31 05-29-41
Akshay Deshpande

Hey Naurumi,

OutSystems doesn’t give the module name directly from the screen, but you can get it in JS like this:

var moduleName = Object.keys($public)[0];
console.log(moduleName);

That gives you the current module namespace.

If you’re navigating across modules, better keep a small mapping of screen → module names in JSON or a static entity for cleaner handling.

Hope this helps! 

Thanks and Regards,
Akshay Deshpande

UserImage.jpg
Narumi Ganaha

Hi Akshay,

Apologies for the late reply on this!

Thanks for the JS snippet. I assume Object.keys($public)[0] retrieves the namespace of the current module, correct?

Since I need to determine the module name of a target screen (which resides in a different module), it seems there really is no dynamic way to fetch it automatically. As you suggested, maintaining a static mapping (like a JSON or Static Entity) seems to be the only way to achieve this if I need to construct the URL manually.

Thanks for confirming that!

2023-10-16 05-50-48
Shingo Lam

To construct the full URL, you can use the GetURL function in HTTPRequestHandler extension. Unfortunately, you still need to specify the module name and screen name + input parameters

Note: it will generate with the ".aspx" (e.g, Home.aspx?input1=abc), use replace function to remove it

UserImage.jpg
Narumi Ganaha

Hi @Shingo Lam ,

Thanks for the tip regarding HTTPRequestHandler.

As you pointed out, the main challenge here is that I still need to specify the Module Name explicitly to use that function. Since my specific goal was to dynamically retrieve that Module Name (to avoid hardcoding it), this approach doesn't quite solve the root issue this time.

I appreciate the suggestion for URL construction, though!

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