Opening View Objects from Query Results
In Dovetail Agent, it is very easy to build a query against a table in the database, and there are standard routines to open most of the table objects to view the items returned in the query. Drilling down to view objects is a little tougher, but it can be done in a few easy steps.
In this example, I will show you how to build a query object for the queelm_case view, which will allow us to open each of the cases in the queue for inquiry. Building the fcQuery object in Dovetail Admin is the first step, so follow along.
After logging in to Dovetail Admin, click on the fcQuery Objects menu link to open the Manage fcQuery Objects page. Typing in queelm_case and clicking the List button locates the view object, and double-clicking the queelm_case row will add the object to the list of fcQuery objects for editing. This screen-shot to the right shows what the screen looks like after this step.
For a view, it is important to indicate what javascript function will be used to open the base object of the view. For this view it is easiest to use the OpenCaseWindow function, which is located in the code/open_window.js file in Dovetail Agent. To add this functionality, click on the queelm_case row in the grid, enter OpenCaseWindow(‘$objid$’); in the Open Function text box, and click the Save button.
The next step is to open the queelm_case object from the grid and add the columns that need to be shown in the query results. Click on the queelm_case row in the grid, then click on the Open button.
The most important field to add in this example is the elm_objid field. This field is what maps to the unique identifier of the case record, known as its objid. The tricky part is to make sure it gets indicated as the Record Id field when it is added as a column.
Adding the other columns follows the normal process, choosing the field by clicking the Path button and finding the desired field, picking the field by double-clicking it, then using the Quick Add button or setting the properties and clicking the Add button.
I chose to add a few other columns from the view regarding the cases, and the final fcQuery Object Columns are shown to the right.
Executing a query based on this object in Dovetail Agent will give me a list of all cases that are currently in queues, and when I double-click on a row in the results window the Case window will be opened so I can view all of the details of the case.
Without specifying the Record Id and Open Function in Dovetail Admin the view does not have enough information to know how to present the detailed view of the case.
Query objects provide a lot of power to Dovetail Agent users, and being able to get the most out of each query helps improve the efficiency of your applications.