Input parameters as reference (shared variables web block)

Hello all,

In Outsystems 8, it is stated that a web block input parameter is passed by reference if on the same eSpace (in older versions maybe that wasn't the case, variables to web blocks were passed by value only). So that would mean shared variable between parent (screen) and child (web block) and that would be great, but it doesn't work, I have tried.  Can anybody help? ..Thank you.
Hi Pedro,

If you read the help section carefully you'll see that the only data types passed by reference are Binary Data, Object and RecordLists. This was already the behavior on older versions.

So no there are no shared variable between pages and webblocks unless you use session variables to do it.


Thank you for your answer Guilherme but I didn't quite understood what you're saying,

Isn't passing by reference (as input parameter) to a webblock of one of those data types means that if we change it in the webblock it will also change in the screen?

Anyway I will explore the session variables.
I will explain better what I want to do is a Check Box list that retrieves data from a table but creates a check box for each one of the variables in that table to tell how many are available.

Well in a editRecord placing inside a list is not possible. So I tried with a webblock. If I do with one editRecord and a list of records it will not be pretty visually (like the editRecord with labels and inputs all in the same table)....What is the recommended approach for this?

With session variables it gives me a warning saying: "Session variables of record list should be avoided" as expected...

Hi Pedro,

What I meant is on the link you've sent explicitly says that only RecordLists, Objects or BinaryData types are passed by reference.

If you're using RecordLists then yes you can do it, because if you pass it as an Input parameter to a webblock and inside the webblock you append a record, then when on the context of the parent page you'll have the record there. This doesn't work for other variable types.

Yes Guilherme you said what i thought initially. So it should work but it doesn't. :=P

I've tried passing by reference a record list to the webblock (as a local variable in the input parameter) but the changes I made in the webblock aren't reflected in the page.

If you read the Help of Service Studio 5.0 it says something completely different from 8.0.

It Says;
"If you are handling Action or Screen Block References, the input parameters are always sent by value, regardless the data types."

So in previous versions of Service Studio it was passed by value to the webblock. So maybe Outsystems should revise the help of Service Studio 8,0 because I think it's still just passin by value and not reference.

Can you guarantee me that it's passed by reference? I will try once more if you say so. But I'm almost sure it doesn't work as reference...

Hi Pedro,

I did some testing and indeed when used in web blocks it doesn't seem to be passed by reference. When used in UserAction it does.

I'll communicate this internally so the reference help might be updated. So for now that leaves you with the session variables approach but its not recommended if your record lists have a lot of information (as per the warning you get).


Any news on the progress of this issue? It's slowing down development on our project.
Session variables are a pain for our purposes. Right now we have triplicate code that could neatly be moved to a webblock, if only the pass-by-reference issue was resolved.

I too am interested in knowing more about this issue. Passing by reference would help trim down and simplify a lot of logic in our project.
Hi Ricardo,

There are no plans to make them work by reference on the cases they are not working by reference now.
The reason there are some current cases by reference is related to performance only, allowing the changes by reference of webblock inputs is only a side effect.

There are indeed some inconsistencies with the documentation, but it is not actually incorrect, just doesn't cover all the scenarios that can make the lists become by value.

There are plans to review the behaviors, but it will be to make them consistently by value, and not the other way around.

João Rosado
Hi João, would those reviews include ALL cases where pass-by-reference is currently working (for example, passing a Record List to a User Action)? I use the pass-by-reference feature quite a bit to help with performance.

I understand the plans may still be only under discussion, but I don't quite see how you could guarantee performance for large Record Lists / Binary Data / etc...

Pass-by-reference is an enormously useful feature for advanced users.