Bug report: client action with both sync and async paths returns undefined in JS node
Application Type
Service Studio Version
11.12.2 (Build 50367)

Our app makes use of a number of client actions called directly within javascript nodes. Ordinarily, inside a javascript node, a synchronous client action (i.e. one that doesn't contain server actions or local database calls) will return an object whose properties equal the action's output parameters, and an asynchronous client action (one that does contain a server action or local database call) will return a promise that resolves into the same kind of object. 

However, I've recently run into an issue when using client actions that can be both synchronous or asynchronous depending on how their logic runs. If a client action contains an if-statement, and one branch of the if contains an async action but the other does not, then when the logic runs down the synchronous branch, the action returns an object whose output values are all undefined. They aren't simply undefined in the Outsystems sense, either, i.e. empty strings for text values, 0 for numbers, etc: they all equal the javascript undefined constant.

To reproduce:

 - Create a client action and give it at least one output.

 - Add an if-statement to its flow, and set its condition to 'True'. 

 - On the True branch, assign a value to the output(s).

 - On the False branch, perform an asynchronous action such as calling a server action. 

 - Create a screen, add a button, and create an attached OnClick screen action. 

 - In the OnClick action, add a JavaScript node. In the JavaScript node, call the client action created in step 1, and log its return value to the console.

Load the screen, click the button, and check the console. 

Expected: The console shows an object with properties equal to the action's outputs, with values that equal the values assigned in the client action. 

Actual:  The console shows an object with properties equal to the action's outputs, but the values are all 'undefined'.



Hi Terry,

It's great you want to report bugs, but the forum is not the place for it. Please open a Support Case with OutSystems, and copy the details you have written here into it. Thanks!

Apologies, I'll get on that. Cheers!

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