Given a form with an embedded web block containing a number of standardized input fields that are re-used across multiple forms, is there any mechanism for the parent form to see the data added to those fields on save?
S S wrote:
Kind of, yes.
You can use session variables for those input fields, so then they can be seen everywhere, but this has a few complications, one of them is the fact that session variables are persistent, so you have to be smart about initialising them. On the plus side you don't need to have any buttons/links to post the web block, so a single button for the entire form will work.
Another way to do it is using the Notify action, but it only lets you pass a single Text to the parent. A easy workaround to this is to concatenate all the input fields using a separator, and then have the parent split the text. This has the advantage of not using persistent variables, so unless you need your input fields prefilled, you don't have to worry about initialising them. On the negative side, you need some way to trigger the Notify action.
Or you could have the web block save its input fields to the database, this makes it easier to "pass" complex fields to the parent, but again, it needs a way to trigger the save to DB.
Hope this helps!
Thanks, that points me in the right direction: I thought there might be something built-in that I was missing!
The reason for not using the database option is that the parent forms' databases are unknown to the web block (the block will be used in multiple contexts).
Notify sounds like the best option, and will likely allow a stringified JSON object to be passed up and then decoded.
You can learn how to do this by following this tutorial: https://leonardofernandes.outsystemscloud.com/eventshelp/Lesson05.aspx
Or you can download a sample and inspect how it's done: https://leonardofernandes.outsystemscloud.com/EventsLesson05/Lesson.Download.aspx
Also check this other tutorial, which allows you to directly invoke screen actions that are inside the web block. You can use this mechanism to dynamically change the web block state, or to retrieve values that are store inside the web block. And, again, you won't need JSON, in fact you can use Service Studio records to pass information around.
Thanks for this Event System.