Page tree

Populating a Linked Field with a Saved Search

This topic describes how to use a saved search to set and update values in fields linked from other tables. The ability to populate a linked field based on the results of a saved search provides more flexibility for populating linked fields than simple matches on a single field, and does not require complex formulas to achieve the same result. 

While configuring the linked field set you will create an Update Fields action and a saved search which are used to set the default value of a linked field.

In the example below, the Companies table contains linked fields to Contract information. When the company is created or updated and its Date Updated field changes, the linked field set to contracts is updated with the contract returned by a saved search. The search finds the contract with a status of valid and which has the latest End Date of all matching contracts.

Setting Up the Linked Field

  1. Edit the linked field set and navigate to the Options tab of the Field wizard.
  2. Under the Set default value section, choose the the option to run an action when the selected trigger field, such as Date Updated, is first set or edited.
  3. Click Create Action to open the Action wizard.

Note: Older releases of Agiloft do not include the Create Action button. You must first create the necessary action by navigating to the Rules tab of the Table wizard. You can either edit an existing rule to access the Actions tab or create a new rule. You will need to save the action but do not add it to any rule.

Creating the Action and Search

Clicking the Create Action button from the linked field configuration screen opens a limited version of the Action wizard where only Update Fields actions are visible and available.

  1. Click Create Update Fields Action.
  2. In the new window, enter a name for the action and click Next. 
  3. Select a field, typically an ID field, from the relevant linked field set that will be populated by the saved search. Click Next.
    Fields tab with Latest Attachment ID selected
  4. On the Values tab, choose the radio button that enables the use of a search to define the field's value. Selecting the radio button enables the drop-down menu that contains a list of saved searches. 
  5. Click Create New Search to open the saved search window. 

  6. Configure the saved search to find the records you want to use to populate the linked field. Do not use run-time filters, since those require input from the user when the search is executed. Remember to save and name the search. 

  7. Close the search window to return to the Values tab.

  8. Select the new search from the drop-down. Choose whether to use the first record returned by the search or all records.

    • For searches that return the first result, make sure the proper Sorting is applied to return the right record. You can click Edit next to the selected search to check the sorting configuration.

    • Using All Results in the search only works for linked fields that accept multiple values.

  9. Click Finish to save the action. The system returns to the Setup > Rules screen automatically.
  10. Select the new action in the list of available actions.
  11. Click Finish to return to the Options tab of the Field wizard.

Saving the Linked Field

  1. In the Options tab, confirm that the new action is selected. 
  2. Select the trigger field, Date Updated, in the second drop-down.
  3. Click Next and Finish to save the field settings.