Can I access One module site-property from another module ?

Can I access One module site-property from another module ?

  

Can I access One module site-property from another module ?

If not is there any way that I can store global variable in common module that can be accessed accross all the modules ? 

No you can't normally.

Unless you use advance sql or extension to read from Outsystems internal table directly.

You're best bet is to create a module containing public entity that is referenced by both of your module.


Solution

Hello,

The standard way to access site properties is through a public action.

But using a site property to hold a global variable is a bad idea. Every time you change its value, you will invalidate the application's cache. Site properties are not meant to be "global variables". Even more as they are shared between all sessions. All your users would see the same value.

Inside the same session you can use Session Variables. They are stored in database and so, they are available everywhere in the same module. Between modules you can use a Get/Set pair of public server actions.

As all the session variables are stored in the same field, and they are serialized/deserialized on every request, it's a bad idea to overuse them.

My advise is DON'T use global variables. I'm pretty sure you don't need them, as they will increase the complexity in your application, making it harder to keep things simple, isolated and easy to test/maintain.

If you really need something like this, you can use also, beside session variable, a mimic system that uses database, with some actions to retrieve/set its value.

Cheers



Solution

Thanks!