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?

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.


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

Thanks André!
Glad I could help.



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?

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?