Description
The Share/UnShare Deluge task can be used in Form/Field action
scripts to dynamically share or unshare an email address to all the Forms and Views in an application or to only specific Forms or Views in an application or to sections under which the Forms/Views are arranged.
This feature enables the owner of an application to define roles and add
logic to share the forms/views with users, based on the roles assigned.
This makes it easy to share the application.
Syntax
share <componenet-type>(<component name>, <email>);
|
where,
-
<component-type> - Refers to the level at which application
is shared. It can have the following values:
- application - to share the entire application.
- page - to share all the forms and views arranged under a section/header.
- form - to share only a specific form.
- view - to share only a specific view.
- <component name> - Select the name of the application
/ form / view / page to be shared.
- <email> - Specify the email address to share the component.
You can either specify an email address, for example, xxx@zoho.com
or add a Deluge expression that will return an email address, as value.
For example, input.emailid, where emailid is the name of a
form field. The shared email ids will be listed under the Share
tab.
Example
Let us take the example of a simple Employee Management application
to illustrate the usage of the share/unshare Deluge task. This
application comprises of the following forms:
- Role Form - To enter the role names, for example,
Team Member, Manager etc.,
- Basic Information Form - To enter the basic information
of employees like Name, Email Id , Role etc. Here, the field Role
is a lookup from the Role Form.
Deluge Script
The script definition of the Basic Information Form is given
below. The on add -> on success script added to this form
will be executed when a new employee record is added to the database
and will dynamically share the employee email id to the forms/views
based on his role. As per the script, the Views "My_Salary_View"
and "My_Basic_Informaton" will be
shared with all the employees where as the View "View_All_Salary"
and "View_All_Basic_Information"
can be accessed only by an employee whose role is "Manager".
form Basic_Information { displayname = "Basic Information" Employee_ID ( displayname = "Employee ID" type = number width = 20 )
Name ( type = text )
EmailId ( type = email )
Role ( type = picklist values = Role.Role )
actions { on add { Submit ( type = submit displayname = "Submit" on success { share view("My_Salary_View", input.EmailId); share view("My_Basic_Informaton", input.EmailId); if (input.Role == "Manager") { share view("View_All_Salary", input.EmailId); share view("View_All_Basic_Information", input.EmailId); } } ) Reset ( type = reset displayname = "Reset" ) } } }
|