This is the onready of the webblock and I am passing an action by object to parent like this
The save function contains:
$parameters.SaveFunction = $actions.Gravar;
Now I am trying to call this action from the parent in a promise like this:
And it works, the console.log is just triggered when the action from the webblock child reaches the end.
But... What I want to achieve also is to pass data from the action. Any ideas?
Can't you pass the inputs as seperate parmeters on the event to the parent?
I dont' want to create an event for that. I want to get data from the promise call
Hi @Filipe Lourenço ,
you could make something work with the Array.every() notation.
I can get that to work with a single parameter.
I think if it needs multiple parameters, maybe use serialize/deserialize ?
Dorine
see attached an example oml, using a single Json as vehicle to pass information from the screen as input to the block's action.
For a single input value, you can just use a basic data type as input and leave out the JSON serialize and deserialize.
But I want is to retrieve from webblock to parent and not
contrary
not sure I understand, you want to execute a function inside the block from the screen, and that should return information from the block to the screen ??
So screen 'collects' information that is inside the block, at a time determined by the screen ??? is that it?
correct
the most obvious is to use an event, like Daniel suggested.
Can you maybe explain the underlying use case, maybe there are other ways ?
Yes but that involves to create another action in the parent to receive the event . I want in the resolve of the promise to catch data in the same parent action.
Ok,
I understand what you are trying to do, but not WHY. Are the normal mechanisms of passing data around in Outsystems not covering what you want to do? Why does your screen need to collect data from your block ? Why can't you just have it come through an event and react to that ?
I get that this would mess up your flow a bit in the screen, having to split up your logic between kicking off the action to collect the data, and reacting to the data coming back, but that would be preferable over this trickery.
We are entering the world of obscure tricks here, which is tough for people later to understand and maintain.
See attached an oml, see demoblock2, the trick is to attach the data to some html element in the block, and pick that up inside the function you shared with the parent. This is all very awkward, and some of the reasons why it is so awkward are :
So there's not a lot to work with here.
If you are going to do this type of thing, please make sure to isolate it properly (like maybe make a special helper webblock doing this).