- Declare variables and assign values to them;
- Invoke user-defined or built-in functions;
- Call client actions, either synchronously or asynchronously, etc.
Use input and output parameters
var nameValue = $parameters.Name; $parameters.OutEmail = "firstname.lastname@example.org";
Call a Client Action
Client actions are available through the “$actions” predefined object. This object contains references to:
- Global client actions defined in the current module or referenced from other modules;
To call a (synchronous) client action that has an output parameter named “Out1”, follow the example below:
var result = $actions.GlobalClientAction(); var outValue = result.Out1;
Instead of typing “$actions.<client_action_name>()” in the code editor, you can drag-and-drop the client action either from the element tree below the code editor or from the “Logic” application layer tab to the code editor.
The example below shows a feedback message to the user stating that his data has been successfully submitted:
$public.FeedbackMessage.showFeedbackMessage("Your data has been submitted.", 1);
- $roles – Contains all the custom-defined roles for the current module;