javascript in expression editor

  
Is it possible to call a javascript function in the expression editor.  Specifically, I want to:

Define a js function for a screen.  In this case it simply calls the js 'confirm' function and returns the result.

In an action screen flow I want to drag an 'if' widget into the flow. In the 'if' condition I want to call the js function which will return true or false depending on the user's response to the 'confirm' in the js function.

In general can defined javascript functions be used in the expression editor?
Hi Bob,

Let's say you want to define a javascript function and then invoke it somehow.

You'd start by writing your function (using the screen / web block / eSpace javascript editor) - see screenshot:




For invoking it, you can write javascript as an unescaped expression (in the UI):




But a better way would be just referencing and using HTTPRequestHandler action RunJavaScript:




If you need to trigger some jsvascript action when the user clicks a button, for example, you can use the button's extended properties (remember to end with return false [see attachment] if you want to prevent the page from submitting):




Usually you need to send some information to a screen action (server-side). There are multiple ways you can achieve this, here's one using an input and a hidden button (the input could have been hidden as well):






See attached a small sample (v8) used for creating the screenshots above.
Thanks.  Appreciate both the very clear answer and the timeliness.  This says a lot about the OS Platform and the company.  I'm new to OutSystems (just now taking virtual Dev Boot Camp course).  The more I learn about the Platform the more I like it.