Zorp Docs
Search…
Low Code Scripting
Programming using Javascript
​
For advanced users, ZORP provides an ability to write JavaScript scripts to manipulate your data fields.
Apart from vanilla JS, we also support the following libraries.

Where to use JS Scripts?​​

JS Snippets can be used when you want to manipulate the data before displaying or storing it. A few examples are given below.
  1. 1.
    Your data has First name and Last name, you want to display them in a single field:
return task.data.first_name + " " + task.data.last_name
  1. 1.
    Displaying the month from a specific date
<Insert snippet here>

How to use JS Scripts?​​

You can write the JS scripts anywhere you find the JS icon.
​
​

Testing the Script​​

In order to test the script you have written, click on the run button below. The output should be displayed in the output box.
Please note that the type of output should match the type of data field expected by the underlying UI component field. For eg., when we write an expression for a number field, the output of the data field should be a number.
All the data fields in ZORP will have mock data generated that can be used while testing.
Click on Update Mock Data to set different values for the mock data.
​

Some more examples​​

  1. 1.
    Getting the first element of a list
let words = ['sky', 'wood', 'forest', 'falcon', 'pear', 'ocean', 'universe'];return _.first(words);
  1. 1.
    Get the current datetime
return `DateTime.now().toISO()`;
  1. 1.
    Get the current time in New York
return `localTime ${DateTime.local({ zone: 'America/New_York' })}`;
  1. 1.
    Format a given time in local format
return ` formatted ${DateTime.fromISO('2018-05-01T13:44:48.708709Z').toLocaleString()}`;
Copy link
On this page
Where to use JS Scripts?​
How to use JS Scripts?​
Testing the Script​
Some more examples​