There are situations where you may want the user to select a record from which data must be retrieved, and this record is not directly related to the main object record. Instead, it is related to a related object of the main object. Or perhaps, you want the user to select a sub-object from a record that is related to the main object. You might even need the user to select a related object or sub-object of a record that is not related to the main object.
For example, if your main object is Policy, you may want the user to select parties Involved (a related object) in the Claim (a child custom object of Policy). This requires two filters: one to specify the Claim and one to specify the Involved.
Another example: you may want the user to select an address (a sub-object) of the contact selected in the Insured field (the contact-centric field) of a Policy (the main object).
These relationships sound complicated but they are not unusual. All of these situations require the use of multiple tc:filter tags, where one filter references another filter to indicate the desired relationship.
These filters are referred to as a main filter and a sub-filter. A sub-filter is a filter that references another filter, called a main filter, to indicate which object owns the sub-object that you are identifying.
You must know the following points about main filters and sub-filters:
•The main filter must be written before all of its sub-filters in the header section, so that the user first selects the record on which the sub-filters are based.
•The main filter must allow the user to only select one record. You cannot use the multi="yes" tag attribute in the main filter tag.
•The main filter can use searchCondition, test, or entity to identify the object record on which the sub-filter is based.
•The sub-filter can use searchCondition or test to identify a related object or a sub-object of the record identified in the main filter.
The following table describes the tag attribute that is used in the main filter. Use this tag attribute in addition to the basic tag attributes noted in the tc:filter Tag Attributes table.
Tag Attribute for Main Filter
Tag attribute |
Possible attribute value |
Description |
usedBy |
"Integer" |
Type the number of sub-filters that link to the main filter. Note: When the usedBy attribute is used, the objectFrom attribute must be used in a sub-filter. |
The following table describes the attribute needed for tc:filter in the header section when defining the sub-filter. Use this tag attribute in addition to the basic tag attributes noted in the tc:filter Tag Attributes table.
Tag Attribute for Sub-Filter
Tag attribute |
Possible attribute value |
Description |
objectFrom |
"MainFilterName" |
Type the exact name that you used for the main filter. |
In this example, notice how the searchCondition of the main filter indicates which object it is pointing to: the Claim records of the Policy. The sub-filter is referencing the main filter, and the searchCondition attribute of the sub-filter is pointing to the Involved Parties of the Claim.
Header |
Main filter |
<tc:filter name="SelectedClaim" searchCondition="Project" qualifier="Application_ProjObjectDefinition_UniqueCode=CLAM" label="Select the appropriate claim" displayString="Name;NumberString" displayFormat="* - *" usedBy="1" /> |
Sub-filter |
<tc:filter name="ClaimInvolvedParties" searchCondition="Involved" label="Please select the parties involved in this Claim" displayString="Contact/FirstName;Contact/Name;DefaultCategory/Name" displayFormat="* * - *" multi="yes" objectFrom="SelectedClaim"/> |
|
Content |
<tc:filter select="SelectedClaim"> <tc:data select="NumberString" /> <tc:data select="Name" /> </tc:filter> <tc:filter select="SelectedInvolvedParties"> <tc:data select="Contact"> <tc:data select="FirstName" /> <tc:data select="Name" /> </tc:data> <tc:data select="DefaultCategory/Name" /> </tc:filter> |
In this example, notice how the searchCondition of the main filter indicates which object it is pointing to: the Contact records of the Involveds. The sub-filter is referencing the main filter, and the test attribute of the sub-filter is pointing to the AddressList of the Contacts.
Header |
Filter |
<tc:filter name="SelectedInvolvedContact" searchCondition="Involved_Contact" usedBy="1" displayString="FirstName;Name" label="Please select an involved" /> |
Sub-filter |
<tc:filter name="InvolvedContactAddress" objectFrom="SelectedInvolvedContact" test="AddressList" displayString="Type/Name;Street;City" displayFormat="* - * *" label="Please Select the Involved's Address." /> |
|
Content |
<tc:filter select="SelectedInvolvedContact"> <tc:data select="FirstName" /> <tc:data select="Name" /> </tc:filter> <tc:filter select="InvolvedContactAddress"> <tc:data select="Type/Name" /> <tc:data select="Street" /> <tc:data select="City" /> </tc:filter> |
In certain circumstances, you will need to provide a filter page that only gives the user one record to select. This is necessary when you want the user to make a selection from a related object or sub-object of an object that is not the main object. For example, suppose you have a contact-centric custom object, Claim, and you want the user to select an address belonging to the contact that is selected in the contact-centric field for the Claim.
In this situation, you have to provide the user with a filter page where the user selects the contact record. This is the main filter, and it must be the only available option. In the next filter page, the sub-filter, the user selects the desired address from the list of addresses for that contact.
The main filter, which only provides one selection to the user, uses the test tag attribute of tc:filter to identify a single record, such as:
•The parent custom object
•The contact in the contact-centric field
•The custom object record with which a task record is associated
A scenario like this is demonstrated in the following example:
Header |
Filter |
<tc:filter name="RetrieveParent" test="Parent" label="Please select the parent policy below." displayString="Name" displayFormat="*" usedBy="1" /> |
Sub-filter |
<tc:filter name="SelectedInvolveds" searchCondition="Involved" label="Please select the parties involved in the parent policy" displayString="Contact/FirstName;Contact/Name;DefaultCategory/Name" displayFormat="* * - *" objectFrom="RetrieveParent" /> |
|
Content |
<tc:filter select="SelectedInvolveds"> <tc:data select="Contact"> First Name: <tc:data select="FirstName" /> Last Name: <tc:data select="Name" /></tc:data> Role: <tc:data select="DefaultCategory/Name" /> </tc:filter> |
In TeamConnect, the sub-filter indicates that it can display the Involved records of the parent Policy selected by the user in the main filter. In the content section, information about the Involved party, which the user selected in the filter page, appears in the generated document.