Add a JavaScript action
About this task
The basic steps for building a JavaScript action:
Procedure
- On a widget that supports events and actions, select the Run JavaScript action from the dropdown list. Click Script Editor to open a mini text editor.
- Enter a name for your script.
-
Enter your custom JavaScript action.
SOTI Snap validates your JavaScript as you type. Click the warning or error messages on the left side of the script editor to see the issues. Although SOTI Snap allows you to save invalid JavaScript code, the script will not work in the app.
-
Hold down Control and Space to insert objects and functions specific to SOTI Snap into your code.
Tip: Type
Snap.
(capital 'S', period included) and then hold down Control + Space to trigger a list of SOTI Snap APIs.Read the API reference documentation at SOTI Snap JavaScript APIS.
- Click (x) to add a reference to an app element or insert environment variables into your JavaScript code.
- Click Done to save your JavaScript action and then Add to add it to your app.
Results
Your custom JavaScript action is ready.