Can I create single client action and call in in different web blocks ? Like I create a validation client action now I want to use it in different web blocks. What is the solution and best approach to use client action ?
Hi,
You can create a client action on the logic tab, that you call in the block client actions.
Regards,
Daniel
Hi Navneet,
You can re-use a client action in multiple blocks or screens.
You can't however re-use a screen client action in other scopes than the block or screen it belongs. In a screen client action, which you will see under the block or screen, in the Interface tab, you will be able to have access to the screen scope (data point and aggregates outputs, input variables and local variables, screen widgets):
While a client action is not bound to the screen, you don't have access to the screen elements. You can however, use input and output parameters to make it generic, like a client action that receives a URL, and opens it in a new tab. It doesn't use any screen element and can be re-used.These client actions, you'll find them under the logic tab:
Kind Regards,João
how can I call this in input event like onkeypress ?
Ok but can we access these client actions in the element events like onchange event ? As I mentioned that I need to use it for validation like input field validation (onkeyup event). So how can I access it as I checked it is not available in the selection.
yes why not, you could just tried to find it out yourself.
I tried but it is not available in the selection popup.
Is the client action you try to use in your block action in the same module?
If it is in another module then you first need to reference it.
Yes, it is in the same module. I need to use it in difference web blocks in same module.
I created a client action ValidateDateInput. Now in webblock1 I want to validate input field using this validation. and same thing I want yo do in webblock2.
Client Action you can use "n" number of time in same module or other module.Just create a screen action where you want to use client action and call the client action in screen action.that's it, it's done.
Hello Naveet,
The reason you cannot see the client action on the dropdown options is that those events only have access to actions on the screen in which they exist.
What you can do is create a Client action in the screen ( LocalValidate for example ) that calls the one you created in the Logic tab ( GlobalValidate), this way you can reuse the logic in all the screens.
Hope it helps!
Paulo Rosário
Maybe I don't understand your issue, but I can create a client action on the Logic tab (SharedClientAction) and then select it inside an action of a block. See screen shot and attached OAP. This are just the basic concept of OutSystems code reusability.
Yes, it's a basic concept of code Re-usability,
Hi Navneet, Are you still facing the same issue then elaborate more in which scenario you can't do like that.
Yes, you can definitely reuse the client action in multiple blocks. If you are still facing the issue kindly share your oml.
Thanks & regards