BUG? Forms - strange behaviour when assigning variable value via Screen action.
1) Create a form, with source "MySource"
2) Add a screen action MyAction, (this screen action assigns a value to MyForm.Record.SomeField)
3) Add a hyperlink and attach it to MyAction, (make sure to change the submit method to AJAX Submit).
4) Add a submit button with submit method Ajax Submit.
5) Publish the eSpace, input some value into any text field, click on the hyperlink (created in step 3)
6) Click the submit button.

You would expect all inputs (user input and action assigned input) to get assigned to MySourceForm.Record, 
it doesn't, only the user input is assigned! 

Note: There is a refresh widget in the submit button flow, it refreshes the form when an error occurs, it refreshes the entire form, and only keeps the values assigned by the user, the value assigned by the screen action in step 3 is removed.  This behaviour does not seem to be a normal behaviour with AJAX submit method.

If you want to keep all inputs the values assigned by the user and the value assigned by a screen action, you will have to assign the value to the source record "MySource". Since outsystems removes values assigned by screen action! 
Rank: #7
eSpace please?

Rank: #30
You can reproduce this issue via the attached eSpace.

(Remember to remove IPP)

Rank: #2
Hi Robert,

I'm not entirely sure what you mean (and the eSpace is still in Processing Upload), but an EditRecord (and perhaps also the new Form) has a local copy of the data structure (as opposed to a TableRecords), which is refreshed on an Ajax Refresh. What you need to do is first assign the EditRecord contents back to its source, make the changes in the source, and Ajax Refresh the widget. (Note this is all from memory, and it's a while back that I needed this - please correct me anyone if I'm wrong.)
Rank: #30

Tha is correct, when the Ajax refresh the source record variable too?  and this is the problem, this behaviour is undocumented, any undocumented behaviour that differs from standard programming behaviour are considered bugs.

Let me explain, when you build this same application in either ASP.NET or JSP and you do an Ajax refresh, it will only refresh the part of the screen and not the whole screen, variables you use in page_load or on_load event are only executed once on load.

I believe outsystems form source record is intended it to work this way, in fact outsystems help documentation explains this same behaviour "The Source Record variable is only copied once into the Form widget, after the screen Preparation finishes. Afterwards, when executing Screen Actions the values stored on the Source Record, will not be copied into the Form's implicit variable, ensuring the end-user input is never overwritten." Reference https://www.outsystems.com/help/servicestudio/9.0/Web_User_Interface/Form_Widget_Properties.htm

The Form/Editable variable should behave as described in outsystems documentation, it should load source record once and once only, even when you use Ajax refresh it should refresh the form UI elements only not the backend form/editable variable as well.  

Without access to the platform source code, I can not see what is actually going on

But what I could see is Ajax refresh reloads the entire widget including the source record variable itself, I know it works like this and how to correct it, but it shouldnt work like this at all, it should copy the variable only once and not reload the variable on a ajax refresh.

Rank: #105
I'm not sure if both cases are similiar, but It looks like someone already had this problem too: 
Rank: #30
Andre, that is a related issue, and it's a bug (that has not yet been fixed).
Rank: #14
When is this being fixed?

This is an annoying misdesign since it doesn't work on editrecord and form.

2018, OutSystems 10, and the problem persists........

Rank: #6

Hello Elize,

Don't know about what was happening in 2015, but since version 9 (the first I used), in 2016, the Form works exactly as it is supposed it to work (and as it should).And the same happens in O10 (now).

When the page load, the Form copies the content in the Source to its own Record.

After that, no matter if you do a Submit (that will execute the preparation and refresh the form), or you do an Ajax Submit + Ajax Refresh of the Form, the Form will NOT copy the source value to its Record again.

But, if in the action you change one of the fields of the FORM RECORD, and refresh the FORM, the FORM will be updated in the screen, for this new value.

And this is the expected behavior.
So, there is no bug related to the Form behavior, now in 2018.


Rank: #5

Hello guys. You have been tricked by OutSystems optimizations... again :)

Let me explain. Your sample app is working flawlessly. Yes, the Description field is blank when you hit Submit. But only because it is not being used at all by your application. So OutSystems throws it away under the carpet. Check the code I'm attaching for a counter-example.

Yes, that can be strange if you are debugging because you don't understand why the value disappeared. But your app continues to work, it produces the exact same output. So it is not a bug. And you end up with a faster application, so you should be thankful for that.

The Form widget works as Jauch explained, and as far as I know, it works exactly like the Edit Records. Both are well documented.


Rank: #3365

Hi all,

I was getting a weird behavior, or so I thought while using the Form widget. So you are saying that, if a Form is being populated by an entity record, even when I refresh the query and the form, if I don't assign the form record to the entity refreshed record, record metadata that isn't being used in the screen will never be updated in the form?

Talking about Traditional Web Apps here.