Zoho Creator : ‘Function’ support in Deluge scripting

Posted by Posted on by

With the recent update in Zoho Creator, we have enriched the deluge language with ‘Functions’ support.

Let’s see, ‘What is Function’ in scripting terminology. In simple terms, ‘A function is a set of statements grouped together under a name and can be invoked/reused from elsewhere in the scripting‘.

Usage of functions can be broadly classified under the following.
1).Write once and reuse utilities
2).Serves as bridge between applications (created by the same user)
3).Custom action integration in views

Write once and reuse utilities :

‘Functions’ promotes code re-usability of deluge script within an application and even across applications (same user’s applications). It makes the code modular and easy to understand.

When you feel like repeating certain scripting functionality across different parts of application, you can define them as separate function and reuse it. With the help of built-in functions provided in deluge, you can create numerous util functions on your own, using the ‘Functions’ support.


  bool isLeapYear(int year)
    leapyear = false;
    if ((input.year % 4) == 0)
      leapyear = true;
      if(((input.year % 100) == 0) && ((input.year % 100) != 0))
        leapyear = false;
    return leapyear;

Help on creating a new function here

More samples here

Serves as bridge between applications (created by the same user) :

Not only can you define generic utilities as functions, you can even manipulate the application data from within the functions. Till now, it was not possible to manipulate the data in one application from the script in another application, which is now made possible with the help of functions. In this respect we can consider application as an object with its data and we can define functions to operate on this data which compares to member functions in an ‘object oriented’ world. The applications can communicate with each other using functions.

Custom action integration in views :

‘Functions’ has the potential to be integrated into various GUI actions, taking the scripting integration in Zoho Creator to next level. It makes the applications created, much more powerful and alive.

As a first step, it is integrated into views under the terminology ‘Custom Actions’. It enables the user to invoke specific function on a selected record in a view.

Custom actions in a view in live mode

More help on custom action in views

- Hariharan

Zoho Creator : Modify data across forms

Posted by Posted on by

In our latest update, we have just made zohocreator more powerful. We have empowered deluge scripting with the ability to modify existing data using our new ‘Update field task’. We already supported fetching of existing form data and now you can fetch and update the values.

Lets us see a library manager in action for illustration

Take a very simple use case : User is borrowing a book from the library

In library manager terminology, it is called ‘Issuing a Book’.

1). The following books are owned by the library.
The column ‘Status’ with values ‘Available’ and ‘Issued’, indicates whether the book is available in the library or is issued to any user.


2).Already the following books were issued to the users on the mentioned issue date.

(Note:This view is created from the form ‘Issue Book’ shown below this view.)
Issued details

3).Now, we are getting a scenario where the user ‘James’ is borrowing the book ‘The City of Joy’.

Use the ‘issue book’ form given below to get book name and user name.

(Note: The above view ‘Books Issued Details’ represent the data in this form. Also in this form, the field ‘Issue date’ is hidden and not shown to the user for filling.)
Issue form

In addition to getting book and user information, we need to do the following

  • Store the current date in the ‘issue date’ field(hidden from user) of the above form, indicating that the book is issued today.
  • Change the status of this book from ‘Available’ to ‘Issued’.(This data is available in different form i.e Book form)

As you can see, these two operations need not be done explicitly by the user as they can be automatically calculated.
This is where our ‘Update field task’ comes into play.

Especially in the second operation, we have to get the corresponding book (i,e. The City of Joy) from the book form data and modify it.

We can use the ‘on success‘ event block of the ‘Issue Book’ form to write the three lines of code , that is going to do the magic.

on success

//store the current time in ‘issue date’ field.
issuedate = zoho.currenttime;

//fetch the book row from the ‘Book’ form
myBook = Book [Name == input.book];

//modify the ‘Status’ of this book to ‘Issued’.
myBook.Status = “Issued”;


Below , you can see the changes done after submitting the form.

  • ‘Status’ of the book ‘The City of Joy’ is modified.


  • Current date is automatcally stored in the ‘Issue date’ field (See the new entry added at the top).

Issued details

Thus you can see that your applications created in zohocreator can just get the minimally required information from the user and modify any other related parameters anywhere in the application using the ‘Update field task’. It helps in incorporating a lot of intelligence into your application, moving away the unnecessary burdens from the end user.Your application can no more be a mere store and retrieval place. It can be more lively now.

You can have a glimpse of my library manager completely created from scratch using our zohocreator.