Create Action Chains in Code Mode

You use the Code mode to create an action chain using JavaScript code. The code editor may be familiar to you if you've used VS Code, as both are based on the Monaco Editor.

To help you write the code, use the editor's Actions palette, Properties pane, and Structure pane like so:

  • Actions Palette: Add an action's code by dragging and dropping it from the Actions palette onto the desired place in the editor.
  • Properties Pane: Define an action chain's input parameters and return object, and an action's properties (code is updated accordingly).
  • Structure Pane: Quickly find and select an action.


For the Switch and If actions, you can add actions to a clause, or create a new one, depending on where you drop the action:

If you add a local function, the function and its actions are added to the Structure pane, and you can view and modify the properties for a selected function in the Properties pane. The local function also gets added to the Actions palette, under the newly created Local Functions category, for you to quickly add a call to it.

To help you focus on currently relevant code blocks, you can fold the code blocks for If, Switch, Run in Parallel, and For Each actions. You can also fold block comments. To do so, hover over the code editor's left margin and click the down arrows for the blocks of code that you want to fold. To unfold a block, click the corresponding right arrow or ellipses:
Description of jsac-foldable-code-code-editor.png follows
Description of the illustration jsac-foldable-code-code-editor.png

If you'd like to change the editor's appearance, right-click on the editor and select Editor Settings from the context menu. You'll be taken to the settings.json file where you can customize VB Studio's code editors. To disable the code minimap, add this entry to the settings.json file: "editor.minimap.enabled": false. For further details, see Manage Code Editor Settings.