Binding Data - Custom Javascript

You have used various sources to fetch data for your apps. You can also add a Custom JavaScript to fetch data and use it for your app operations. You can Import JS libraries and use its reference to run complex JS operations and bind data to your controls directly. Any change in the controls will trigger the re-evaluation of the JS Function.

Under the Bind Data, you can get the option to add Custom Javascript.

So whenever you select the Custom Javascript option, you can add the necessary Dynamic values as Input parameters and define a function that would act as the source data for your applications.

Input Parameters

The input parameters are passed as arguments to the Javascript function you define. It is important to ensure that the right data type is used. Ensure that you add a test value for the script.

  • Name: Is the variable name that is passed as the input parameter
  • Keywords: Is the source of the input parameter. It can be the fields, keywords, or variables.
  • DataType: Is the type of data expected to be entered as String, Number, Boolean, and so on.
  • Test Value: Is the sample or test value to be used.

You can then add your Javascript code and use the necessary parameters.

So in this example here we have used a simple script for the password validation where the inputtxt is the value from the text input control (named: enterpassword) received from the Form.

So if you Test Script you can then view the output in the Code output section. Once you verify the output is as expected then you can save the script and click Test and Save. So now the script would act as the source to bind data to your controls.

Note:

  • Whenever the Control or Variable used as the input parameter is updated this JavaScript code will get executed automatically.

  • When you click Test & Save the CUSTOMJS() function is added internally. It can be verified in the Custom Formula option. The CUSTOMJS() function cannot be invoked from another function. If you want to add additional computations you can build it in the Custom JS Block with parameters.

    customjs function