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
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:
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()
None of you gave the correct answer nor undestood his question.
What he wants to do is pass an action as an input parameter and then eval it inside the fuction.
Something like
var action = (Action) InObject1; //contains $actions.Click()
Response = setTimeout(function() { eval(action);}, 2000);
Obviosly this does not work. Does anyone has the correct answer?
Christian Devetak wrote:
Response = setTimeout(function() {eval(action);}, 2000);
Wauw Christian,
it takes a special type to first talk down on people who are just trying to help, and then demonstrate that you also completely misunderstood...
Dorine
Hi,
Does anyone have a solution to this? I am unable to pass the input parameter to the client action in the javascript as well.
Wesley Lee wrote:
Hi Wesley (I guess original poster has moved on from this),
See attached oml, you can just pass in values for the inputs as a comma separated list between the brackets, and you can get the value of outputs by name.
This is for example a client action with 2 inputs and 2 outputs, output text gets formed based on input values, and output datetime is set to current datetime.
This is the JS calling this client action
result = $actions.ClientActionXXX(666,"I rock");alert(result.OutText + " ("+ result.OutDateTime + ")");
This is result of test
Hope this helps you,
Dorine Boudry wrote:
Thanks Dorine!
I was using the same syntax initially similar to your suggestion. It turns how that my input parameter (EventId) should be set to integer instead of Event identifier for this to work.
Thanks for information, I also had this question.