Fetching data from webblock to web-screen without using any action.


I have made a web-screen where I'm using a web block. I want to fetch the data from web block(child) to the web-screen (parent).In the preparation of the web block, I'm fetching data from an entity and displaying in the web-block as form edit and thats it. The requirement is I cannot use any new action like button, tick-marks etc inside the web block, ie.. the web block is only to display data to the user. Now there is a submit button in the web-screen (parent). On click of that button (which is in parent screen NOT in web-block), I want to store the data from the web-block (child) which is inside the web-screen (parent) into another entity.

It will really appreciable if someone explains the solution.

note: if anyone wants to answer as for using Notify or NotifyMessage, Where do I use it? Remember, I'm not using any new action in my web-block.

How do I do it ?????


You can do it with a bit of trickery (hence I don't recommend this pattern):

  1. Create a hidden button in your web block.
  2. Assign it a class that's unique for your app.
  3. When you click that hidden button, call a screen action that serializes the information you need into JSON and then invokes the Notify action;
  4. Change the button on the parent screen so it uses Javascript to click the button in the web block, using a CSS selector by the unique class to find it.
  5. The handler for the web block's notify can then call the GetNotifyMessage, deserialize the information into a structure and save it into an entity.

Beeta, I must know: why are the requirements like this? It is making the problem excessively difficult for no imaginable benefit in my mind. Every solution I can come up with, there must be some action in the web block. I think you could use the Event System forge component (https://www.outsystems.com/forge/component/597/event-system/) to trigger a "save" action in the child web block, but you would need an action to save the element in the web block. 

Beeta, I have attached a module using the above forge component as part of the solution. This is the best solution I can think of without adding any buttons to the web block (but I hope the "SaveRecord" action and the invisible screen action invocation web block are acceptable). 



Hi Beeta Sahoo,

I'm with Grayson... I don't really such restrictive requirements. But I have to ask... if the web block is displaying data from an entity record... why not fetch that entity record (again) on the action that your web screen button executes? This way you get the data to copy to your other entity and don't have to touch the web block at all.

Hi Beeta,

Please try to make things simple as Jorge suggested you can fetch the data again fro  database which are displayed in webblock on click of save action on parent screen in such way you do not need to do any extra activities.



Hello All,

Thank you, João, Grayson, Jorge and Shashi for your kind replies and sorry for the late reply.

 I think everyone is more concern about how there is such a requirement. I will definitely talk about this.

firstly, let me go through these solutions and try with myself and I will be right back.

Hello There everyone, I tried the solution what  João suggested. I created a button in the web block and inside that button, I have performed operations to store the data to the entity.

And in main web screen when I'm using that web block, I'm hiding that button which is in the web block with CSS code. It's a hidden button now. I'm giving that class name of the button as "hiddenButton".

Now in the main button which is inside the web screen. I'm calling the hidden button with this javascript code and the code is as follows : 

SyntaxEditor Code Snippet

"var els = document.getElementsByClassName('hiddenButton');

So when the user is clicking to the button from the web screen, both the buttons are getting clicked at the same time. So by this, the things are achievable.

Thanks, João and thanks to everyone for your kind suggestions. Really appreciate.

Hello, I wonder if you still have a Module that realizes this function. I want to learn from it

Also, if I have multiple Web Blocks (sons), how do I get the values of all Web Blocks (sons) when the user clicks the button from the Web screen

I have been puzzled by this problem all day. I hope you can help me

Thank you very much. Have a nice day

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.