7345
Views
12
Comments
Calling a Screen Action from Javascript
Question
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
2020-03-05 15-52-45
André Vieira
Staff
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é
UserImage.jpg
Koushiki Kodeboyina

HI André Vieira

I made a Map and wanted to locate my position using a click action. 

I did the same what you suggested but that was working only when opened in the browser. 

When I publish it as an app and try clicking on mobile the click action was not trigging. 

Do you have any solution for it. 

UserImage.jpg
José Fernandes
Oh!

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

Thanks André!
2020-03-05 15-52-45
André Vieira
Staff
Glad I could help.

Cheers,
André
UserImage.jpg
Gintaras Svalbonas

Hello

How about action's input parameters?
2011-08-23 22-04-05
Tiago Simões
Staff
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
2019-01-13 21-12-27
Filipe Santos
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?
2024-06-26 06-49-09
Dileep Kumar Verma

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



2018-11-06 14-26-44
Suraj Borade

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);

2018-01-19 03-18-31
indra budiantho

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

2019-09-24 18-41-25
Jorge Martins
 
MVP

Dileep, Suraj and Indra,

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

2018-01-19 03-18-31
indra budiantho

Hi Jorge,

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

Thank you.

regards,

indra

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.