Tray Embedded / Advanced Topics / Custom JS / Custom JS Intro

Custom JS Intro

Overview

The Custom Javascript feature allows you to control the behaviour of configuration slots by inputting your own Javascript functions.

This is a very powerful tool for extending the functionality of the wizard, which is used in conjunction with functions such as callConnector to leverage an End User's authentication and directly invoke any of the available Tray.io operations for a particular service.

This has a huge number of use cases in terms of End Users being able to directly update and query service data via simple actions in the Config Wizard. Common ones being:

  • Generating dropdown lists

  • Customising the data mapping component

  • Showing/ hiding slots based on dependencies

  • Validating authentication and configuration slots

Using Custom JS

The steps involved in implementing Custom JS are:

  1. Set the required project config in your workflow(s):

set-project-config-id
  1. In the Solution Editor, enable the feature for the slot and click the pencil icon to edit the Custom JS code:

enable-custom-js
  1. Edit your Custom Javascript as you see fit:

enter-custom-js.png