Ajax (1) Apex Class (12) Apex Trigger (2) Community (2) Home Page (1) HTML (4) Integration (3) JS (7) KB (1) Label (1) Licenses (1) Listing (1) Log (1) OOPs (5) Sharing (1) Static Resource (1) Test Class (3) URI (1) Visualforce (10)

Thursday 13 March 2014

define lookup filters

To define lookup filters: "Customize Application"
To define a lookup filter:
  1. You can create lookup filters for new relationship fields in step 3 of the custom field wizard. To create a lookup filter on an existing field:
    1. Navigate to the fields area of the object that contains the relationship field:
      • For standard objects, from Setup, click Customize, select the appropriate object from the Customize menu, and clickFields.
      • For custom objects, from Setup, click Create | Objects, and select one of the custom objects in the list.
    2. Click Edit next to the name of the lookup or master-detail relationship field to which you want to apply the filter.
  2. In the Lookup Filter Options section, click Show Filter Settings.
  3. Specify the filter criteria a record must meet to be a valid value. To specify criteria, click Insert Suggested Criteria and choose from a list of suggested criteria, or manually enter your own criteria. To enter your own criteria:
    1. In the first column, click the lookup icon or start typing in the text box and select a field.
    2. In the second column, select an operator.
    3. In the third column, select Value if Salesforce should compare the field in the first column with a static value, or selectField if Salesforce should compare the field in the first column with the value of another field.
    4. In the fourth column, enter the value or select the field that Salesforce should compare with the field in the first column.
    Note
    • Click Add Filter Logic to add Boolean conditions.
    • You can select from fields on the current record, the lookup object, or the user record. You can also choose related fields that are one relationship away from the lookup object. Salesforce assists you by listing the available fields and relationships when you click the lookup icon or click inside the text boxes.
    • Lookup filter criteria can compare fields of different types as long as they are compatible.
  4. Specify whether the filter is required or optional. For fields with optional lookup filters, only values that match the lookup filter criteria appear in the lookup dialog initially; however, users can click the Show all results link in the lookup dialog to remove the filter and view all search result values for the lookup field. Also, optional lookup filters allow users to save values that don't match the lookup filter criteria, and Salesforce does not display an error message if a user tries to save such values.

    For required lookup filters, specify whether you want Salesforce to display the standard error message or a custom message when a user enters an invalid value.

  5. Optionally, enter text to display in the lookup search dialog. Consider text that guides users in their searches and explains the business rule that the lookup filter implements.
  6. Leave Active selected.
  7. Click Save.
Important
When creating a lookup filter on a master-detail relationship field, verify that the current values of the field on all of the detail records meet the criteria you specify. If you specify criteria that an existing value doesn't meet, Salesforce prevents the user from saving changes to the detail record. If this occurs, the user must first modify the value on the master record to meet the criteria. For example, consider a custom object with a master-detail relationship field that points to accounts. If you define a lookup filter that excludes all accounts with a Create Date before 01/01/2009, verify that no existing records of that custom object have a master-detail relationship with any account created before 2009. A quick way to do this is to create a report that shows all accounts with a Create Date before 01/01/2009.
If at some point you no longer need this lookup filter, return to this page and do one of the following:
Deactivate the lookup filter
Deactivating a lookup filter preserves the lookup filter configuration but:
  • Prevents it from applying to the relationship field
  • Prevents it from impacting the cross-object references limit
  • Removes it as a dependency for fields referenced in the lookup filter criteria
To deactivate the lookup filter, deselect Active, then click Save.
Delete the lookup filter
Deleting a lookup filter permanently removes it. You cannot recover deleted lookup filters. To delete the lookup filter, click Clear Filter Criteria, then click Save.

Viewing a List of Lookup Filters for a Target Object

You can quickly see a list of all of the lookup filters that restrict the values of each target object. This is useful when creating similar filters for a target object. Also, lookup filters that reference fields on related objects count against the cross-object reference limit, which is the number of unique relationships allowed for a target object. The Related Lookup Filters list lets you see which lookup filters might impact that limit. To see which lookup filters affect the limit for a particular target object:
  • For standard objects, from Setup, click Customize, select the object from the Customize menu, and click Related Lookup Filters.
  • For custom objects, from Setup, click Create | Objects, select one of the custom objects in the list, and scroll to the Related Lookup Filters related list.

No comments:

Post a Comment