I'm a total OutSystems beginner. I've written a Block that wraps a JS library in a Library Module, and use it in an app Screen.
The Block has input parameters which I use for configuration. The Block also emits an Event, which the screen handles in a Client Action.
What I'm struggling with is probably very simple but I just can't figure it out from the documentation: how can I reference the Block, which is part of the Screen's widget tree, in the Client Action? When the Event occurs, I would like to update an input parameter on the Block (setting an 'enabled' input parameter to false while the user makes some decision, and setting it back to true when the user wants to continue). I've tried using an 'Assign' statement in the Client Action but the Block does not show up in the dropdown for the lefthand side of the assignment.
I think I figured it out... at least one way of doing it...
1) Added a new local variable 'enabled' to the screen.
2) Connected Block's input parameter 'enabled' to the new local variable
3) Update local variable in Screen's Client Action
Not sure if that's the proper way of doing things (feels a bit redundant), but it seems to work.
Hi @Alex Suzuki,
If feasible please share the OML or relevant screenshots to understand better.
Thanks,Vignesh Prakash.
1) Screen contains a Block named 'BarcodeReaderBlock', event is handled in 'BarcodeDetected' Client Action.
2) BarcodeDetected Client Action displays a value from event, here I want to toggle the 'enabled' property of the Block, but don't know how to reference the Block.
Thanks for any advice/helpful pointers.
Hello @Alex Suzuki ,
If I understood correctly, maybe you should pass the enabled as an input of the block and make some logic in the On Parameters Changed of the web block.
Training about On Parameters Changed
https://learn.outsystems.com/training/journeys/blocks-and-events-635/on-parameters-changed/o11/82
Hope this helps :)
Regards,
Pedro
Hi Pedro
The block already implements OnParametersChanged... it runs some JavaScript that calls through to the wrapped JS library.
What I don't understand is how can I set the 'enabled' input parameter in the Client Action? I know how to set it in the Block's configuration, but I would like to change it at runtime.