The sample application Meeting Tracker application illustrates how to add records to a form from a view.
1. Add Meetings Form
2. Add Meeting attendance - The form to enter attendees for each meeting. This form will be invoked from the meetings view by selecting the button as shown below
The attendance details for each meeting can be viewed by selecting the view attendance button, as shown below
Now let us learn how the custom buttons "Add Attendance" and "View Attendance" are added to the meetings view. The "Add Attendance" and "View Attendance" are called custom action buttons. "Custom Action" is a feature integrated in ZC Reports to enable users to invoke a specific user-defined function on selected records in a report
In this application, "Add attendance" custom action invokes the function that will display the "Add meeting attendance form". Similarly, the "View Attendance" custom action invokes the function to display the attendance view
Steps to configure the Add Attendance function and custom action
(The same steps can be followed to configure the View Attandance custom action, to view the attendance for each meeting).
a. Defining the Function :
1. Select Script ->Function tab and define a new function by selecting the New button.
2.In the Functiondialog, specify the function name, namespace, return type and arguments to be passed to this function. In this example, we define a function named “addattendance” that will display the “Add Attendance” form for the selected record in the view. Hence, return type is specified as voidand the recordidis passed as argument to the function.
3. Click Done to add the function.
4. Drag-n-drop the Open URL deluge task to the editor-area. Click on Edit button and specify the URL string, popup window to open, height and width parameters, as given below.The OpenUrl task redirects the form to the specified URL.
Add_Meeting_Attendance - is the name of the form to be displayed
meetingid - is the name of the field in the Add_Meeting_Attendance form
input.id – id is the function argument which will pass the value of the selected record ID and update it in meetingid.
5.Click Save Script to update the changes.
b. Configuring the function as Custom Action in the View :
Here are the steps to configure the function named “addattendance” as custom action in the meetings view.
1. Select Reports ->Meetings and click on Custom Actions from the left-side tree.
2. Specify the Action Name, the action display type and the function to be configured.
3. Click Done to update the changes.
The above configuration will add the custom action button to each record in the Meetings View. When the button is clicked, the form Add Meeting Attendance is displayed for the selected meeting.
To view the functions and scripts added to the application
- Copy the application by selecting Options ->Copy Application link displayed in the top-right corner. The application will be copied to your account and displayed in your Home page as “Copy of Meeting Tracker”.
- Select the Edit button to view the application in Edit mode.
- Click on Script ->Function tab to view the functions added to the application. The addattendance function will pass the value of the selected record ID and update it in the meetingid field of the “Add Meeting Attendance” form.
- Click on Script ->Forms tab and select Add Meeting Attendance form, to view the scripts added to this form. The field meetingid is not displayed to the user when the form is loaded. Only the Meeting Name that corresponds to the selected Meeting ID is displayed. You can view the script that is added to the on Add ->on Load section of this form to achieve this.