How to pass input parameter of Client Action in javascript?

How to pass input parameter of Client Action in javascript?

  

Hi Everyone,

From Javascript, I'm Trying to call a client action which takes an input parameters.
Something like:
Response = setTimeout(function() {
     $actions.Click()   // No Input parameter added here :(
    }, 2000);

 Here Click() is client action with "Source" as an input parameter and "result" sa an output parameter.

1. Can Someone please help me how to pass input parameters of Client Action from javascript?

2. To get output of client action:  Response.result;  Is It Ok?
   


Hi Tony,

If I understood correctly, then you want to pass some value from Javascript to your OutSystems screen action.

Please follow bellow post to achieve that:

https://www.outsystems.com/forums/discussion/7626/how-do-you-pass-a-javascript-variable-value-into-application-variable/

Please do let us know if that solves your purpose.

Thanks,

Som

Hi Tony,

For more info on how to use JavaScript in OutSystems 10 Mobile you can check the documentation: https://success.outsystems.com/Documentation/10/Extensibility_and_Integration/JavaScript/Extend_Your_Mobile_App_Using_JavaScript

Be aware though that the output of setTimeout method is not the output of your Action (check this), and without giving it much thought I'd assume you pass input parameters as you would any other javascript function/method... and the same goes for the return value 

Tony Sumi wrote:

Hi Everyone,

From Javascript, I'm Trying to call a client action which takes an input parameters.
Something like:
Response = setTimeout(function() {
     $actions.Click()   // No Input parameter added here :(
    }, 2000);

 Here Click() is client action with "Source" as an input parameter and "result" sa an output parameter.

1. Can Someone please help me how to pass input parameters of Client Action from javascript?

2. To get output of client action:  Response.result;  Is It Ok?
   


Hi Tony,

In outsystem 10 if you are working on mobile app,You can create input & output parameters in JS and assign it to the values. Please refer examples as below

1) Here I am calling an Action1 clicking on Button(Action2) and providing input to the Action1 while calling it.

2) assigning output of JS to var1.

I hope you are asking for the same. Please let me know if you have any doubt.

Sachin


Just wanted to update this with something I ran into today: I'm building a string of hex values, converted from decimal, and used the builtin javascript toString(16) to convert. Below is the code, then a screenshot of the javascript object used in the client process (mobile app):


$parameters.HexOut = $parameters.TempDec.toString(16).padStart(2, "0").toUpperCase()