Table of ContentsDown
Returns the current date in the format as specified in the Application Settings dialog.
info "zoho.currentdate "+zoho.currentdate;
Returns the current date along with the time value.
info "zoho.currenttime "+zoho.currenttime;
To get the current date and time and input it into a field upon success,
- Create a Date-Time field, for example, named TimeStamp
- In the onAdd ->on Success section and on Edit ->on Success sections of your Form, add the following script code, where zoho.currentime is the Deluge system variable which returns the current time. The current time will be updated in the field named TimeStamp. You can also disable the field so that it is not edited by users.
Every record in every table (form) has two fields (Added Time and Last Modified Time) that ZOHO Creator automatically updates when ever a Form is clicked on the Submit or Update Buttons, so you could elect to show these fields in your List View. Refer the topic Display username and time for more information.
Email id of the logged in user is available as Zoho variables in all the applications created using Zoho Creator. The variable zoho.loginuserid can be used in scripting to write logic based on the user viewing your application. For example: You can have an application in Creator where you have data related to all your customers but you can make sure that each customer is able to view only those records that belong to him, based on their logged in emailid.
The table given below lists the zoho variables and value returned by the variables in a private and public application.
|Zoho Variable||Private app/Logged-in user||Public app/Logged-in user||Public app/Public user|
|zoho.loginuserid||Emailid of the currently logged-in user||null||null|
In the following sample code, userid field will display the current login email id of the user.
type = formula
value = zoho.loginuserid
In a leave application, users will submit their leave in the leave form. When a user logs in, he will see only the leave details belonging to him.
list "My Leave Details"s
show all rows from emp_leave_form [Employee_email == zoho.loginuserid]
Employee_email as "Employee email"
Leave_type as "Leave type"
From_Date as "From Date"
To_Date as "To Date"
[Employee_email == zoho.loginuserid] - The filter to display only the leave details of the current user
- 'Employee_email' is a field in the form emp_leave_form
- 'zoho.emaild' is the deluge variable.
The variable zoho.adminuserid returns the emailid of the application owner. It can be used in scripting to write logic based on the user viewing your application. For example, you can make sure that certain views can be accessed only by the admin user (application owner) by adding the following criteria to your view:
show all rows from <form_name> [<email_field_name>l == zoho.adminuserid]