JS Functions (Coming Soon!)

JS functions allow you to write your own logic and application workflows in javascript.


Every JS function has access to all the objects in the application i.e Widgets, APIs, Global Settings, etc. These are imported in every JS class file and can be accessed directly.

JS Class

Every JS function is wrapped in a JS class file with a run method. The JS class name is used to access the JS function in the page. The run method is executed by the framework when a function is bound to a Widget.

You can write your logic and trigger any actions in the run method. The return of the run method will be stored in the object of the JS Class. So, a function to aggregate order amounts might look like

class AggregateOrders {
static run() {
return await fetchOrders.run((orders) => {
return _.sumBy(orders, (order) => { return order.amount });

and the aggregate data could be accessed as {{ AggregateOrders.data }}