Source Record and Source Record List - when are they assigned?

Source Record and Source Record List - when are they assigned?

  
When is source record assigned in a form?
 
It is assumed that the source record is assigned into a form record variable when the form is rendered and displayed on the webscreen. i.e Preperation is executed before the webscreen is rendered, webscreen widgets are assigned the source record then it is displayed.

 
Ok now, but why do I get two different results here? http://screencast.com/t/ccQtbrYIo
 
same input values 
webscreen1 “metadata” record variable is assigned on preperation, then the web block is rendered - it displays correctly.
 
webscreen2 “metadata” record variable is assigned when the screen action is executed (when the button is clicked) and then the web block is refreshed, in this case it assumes the source record would be reassigned into the web block input parameter (since it has been refreshed it should!)

If you look in the debugger, the results are correct, but the display of the values are incorrect. (the values are correct but it doesnt get displayed for some strange reason!)

Hi,
Can you post your eSpace?
<WebBlockContainer>My web block goes here </WebBlockContainer>

If you refresh the "WebBlockContainer" using ajax, it should refresh the web block widget in between it! Right?

Verified using debugger: the variables get assigned the correct values, however when the assigned values are not displayed onto the screen.
Paulo - eSpace attached
Can you post the RestEngine extension as well?
Paulo

Attached
As a workaround, you can add a Preparation to your MetaDataFieldBlock webblock, then an Assign with:

MetaForm.Record = Meta
This will work as expected, showing the correct values. However, I don't have a good justification for this...
Maybe someone from the Engineering team will have a good explanation... if not, you can follow-up with OutSystems Support.
Paulo Ramos wrote:
As a workaround, you can add a Preparation to your MetaDataFieldBlock webblock, then an Assign with:

MetaForm.Record = Meta
This will work as expected, showing the correct values. However, I don't have a good justification for this...
Maybe someone from the Engineering team will have a good explanation... if not, you can follow-up with OutSystems Support.
 Typically, the "Form" gets assigned the source record value when the form widget is loaded right? it only does this once!

This is happens right now...
  • Source Record, Source Record List are assigned only once when the widgets are first displayed.
  • Refreshing (reloading) the widget via Ajax Refresh will not reassign/reload the source record/recordlist variable!
Paulo Ramos wrote:
As a workaround, you can add a Preparation to your MetaDataFieldBlock webblock, then an Assign with:

MetaForm.Record = Meta
 This work around works (BUT ONLY ONCE) , if you attempt to update the metadata records, the form will not get updated!! Even when you manually assign Form with meta record variable in the preparation flow.

See video http://screencast.com/t/U7aWvB2C2y

Issue: Debugger tells me that the new are not being assigned to the web block, they are only assigned once and after this all new values are ignored.

Run the debugger on "MedaDataWebBlock" you will see what I mean, ... is this a bug?
The workaround works only once, but that's caused by a bug (?) in the JSONToRecordList action (RestEngine extension). Every time you invoke it, it adds a new row to the list, instead of replacing the current one.

In your WebScreen2\Submit action, if you clear the MetaDataList object (use the ListClear action for that) before invoking JSONToRecordList, it will work as expected.
Paulo Ramos wrote:
The workaround works only once, but that's caused by a bug (?) in the JSONToRecordList action (RestEngine extension). Every time you invoke it, it adds a new row to the list, instead of replacing the current one.

In your WebScreen2\Submit action, if you clear the MetaDataList object (use the ListClear action for that) before invoking JSONToRecordList, it will work as expected.
After adding "ListClear" to clear "MetaDataList it works as expected.

1) But why does "ListClear" work?  If you assign an empty list to MetaDataList, this should also clear "MetaDataList", somehow it does not! (strange?) I need to see the code under the hood to determine the cause of this problem!
2) Why is it neccessary to manually assign a record to the form, shouldnt form source record assign the form variable for you? (in this case its seen form record varable are only assigned the source record only and can not be reassigned new values simply by refreshing the form to reload itself via ajax refresh, you would think it would reassign the value when the web block is reloaded but it does not!)
@Paulo

Concluded there is definately a bug in the source record -"FORM" widget.

Try replacing the forms widget with an "EditRecord" widget, everything works correctly as expected, refreshing a widget will refresh the editrecord values with the source value (expected behaviour) now you dont need to manually reassign the source value in Preparation flow.

Note: EditRecord source record and Form source record behave differently, it shouldnt behave differently it should behave the same! Source Record in which ever widget source record is used, source record is the record that is loaded on event widget load (including widget refresh). -  there is a bug in form source record.
Hi Robert,

«But why does "ListClear" work?  If you assign an empty list to MetaDataList, this should also clear "MetaDataList", somehow it does not!»

But the list is NOT empty - it will keep the values from the previous submitted json. This is normal.
I would argue that the extension should be clearing the list - but it's a custom extension so... (btw, is it from any Forge component?).

«Why is it neccessary to manually assign a record to the form»

I hinted above that this could be a support case / feedback... I certainly agree that I would expect a similar binding behavior as an EditRecord!
But keep in mind that the Support team doesn't actively monitor these forums. As you know, you can submit feedback to Support, either anonymously (for example, from Service Studio, Help menu - if you don't wish to track the issue) or creating a support case.