Calling a Screen Action from Javascript

Calling a Screen Action from Javascript

  
I'm banging my head trying to find a way to call a Screen Action from a javascript function. And can't find anything remotely close.

Is there any way to do it?

Thanks
José Miguel Fernandes
Hi José,

Screen Actions are associated with buttons on the webscreen or events on inputs (this depends on the Platform version you're using).
To have a javascript function calling a screen action you must trigger a click on a button of the page or the event of the input.

Put a button on the page an hide it using css  (style="display: none;"). Name that button so that you can reference it latter, for instance 'MyButton'. Then in your javascript function force the click action on that button, something like:

document.getElementById(<your button reference>).click();

The button reference can be obtained by accessing MyButton.Id in an expression editor on Service Studio.

Hope this helps you.

Cheers,
André
Oh!

Gonna do that. Almost seems too easy looking at it like that :D

Thanks André!
Glad I could help.

Cheers,
André

Hello

How about action's input parameters?
Hi José,

If you want to send a parameter to a screen action using javascript you could add an (invisible) input widget and set its value using

document.getElementById(<your input widget reference>).value = "value"; 

before clicking the button. This input should be bound to a local variable that you could use in your screen action.
Was this what you were looking for?

Cheers,
Tiago Simões
What if I wanted to invoke an Action automatically - ex: after a period of x seconds - without either click() or input parameters methods?
(Because input parameters method doesn't suit my needs and neither the the click method. I already tried with the click() method and the problem is it closes a popup window when the button is "clicked" which is a problem, in my case, related with user-friendly matters).

Any idea?

José Fernandes wrote:

Hi Jose,

you can try using

$actions.clientActionName; I tried it in OnApplicationReady Action calling Screen Client Action, It Works.

thanks

Dileep

I'm banging my head trying to find a way to call a Screen Action from a javascript function. And can't find anything remotely close.

Is there any way to do it?

Thanks
José Miguel Fernandes



Dileep Verma wrote:

José Fernandes wrote:

Hi Jose,

you can try using

$actions.clientActionName; I tried it in OnApplicationReady Action calling Screen Client Action, It Works.

thanks

Dileep

I'm banging my head trying to find a way to call a Screen Action from a javascript function. And can't find anything remotely close.

Is there any way to do it?

Thanks
José Miguel Fernandes




I am not sure if Filipe is still interested in the solution. 

Filipe,

First thing you need to check is what is that code which closes popup after clicking on button and remove it.

If you want to click button automatically after some time you can use this javascript code.

setInterval(function(){ logic to click button; }, 3000);

Hi, Jose.

Here is a sample for javascript calling server action with parameters:

https://www.outsystems.com/forums/discussion/34080/fancy-multi-select-all-selected-text/

regards,

indra

Dileep, Suraj and Indra,

Please refrain from resurrecting a post almost two years old that was already resurrecting a post from 2010... 

Hi Jorge,

Sorry, I did not see the date, thinking this is a new one.

Thank you.

regards,

indra