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. Lodash () Luxon()

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.

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 Displaying the month from a specific date

How to use JS Scripts?​ You can write the JS scripts anywhere you find the JS icon.

​Script Entry Point​

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. Update Mock Data​ Some more examples​

Getting the first element of a list

let words = ['sky', 'wood', 'forest', 'falcon', 'pear', 'ocean', 'universe'];return \_.first(words);

Get the current datetime

return `DateTime.now().toISO()`;

Get the current time in New York

return `localTime  ${DateTime.local({ zone: 'America/New_York' })}`;

Format a given time in local format

return ` formatted ${DateTime.fromISO('2018-05-01T13:44:48.708709Z').toLocaleString()}`;