Share / Unshare
The "share" deluge task is used to share an application or its components with users. A mail with a link to access the application is sent to the user when this task is executed. The "unshare" deluge task is used to revoke access for a previously shared application or its components.
share <component-type>(<component name>, <email>);
- <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 only a specific page.
- form - to share only a specific form.
- view - to share only a specific report.
- <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, firstname.lastname@example.org 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.
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.
The following script is added to the on success workflow section of the Employee form and will be executed when a new employee record is added to the database. It will dynamically share the employee email id to the forms/reports based on his role. As per the script, the Reports "My_Salary_View" and "My_Basic_Informaton" will be shared with all the employees where as the Reports "View_All_Salary" and "View_All_Basic_Information" can be accessed only by an employee whose role is "Manager".
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);