Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This feature enables filtering lookup fields in the modals in lightning components and Download/Upload TemplatesLookup Filter Label Mappings allow organizations to specify the lookup filters and alternate fields to be displayed in lookup dropdowns on lightning components or related downloaded templates. This is done by specifying the lookup filter criteria in a new Custom Metadata Type (CMDT) named xx_Lookup_Filter_Label_Mapping_mdt.

CMDT Structure

The CMDT includes the following fields:

  • Source Component (Picklist): xx_Source_Component__c

  • Child Object (Text): xx_Child_Object__c

  • Parent Object (Text): xx_Parent_Object__c

  • Lookup Field on the Child Object (Text): xx_Related_Lookup__c

  • Filter Condition (Text): xx_Filter_Condition__c

  • Label Field API Name (Text): xx_Child_Label_Name__c

  • IsActive (Boolean): xx__isActive__c

Info

In Label Field API Name (Text): xx_Child_Label_Name__c, please enter the API name using a supported data type.

Supported Data Types include:

  1. Email

  2. Phone

  3. Picklist

  4. Text

  5. Text Area

  6. URL

  7. Lookup

Note

If there are no records with a value in the field specified by the Label Field API Name: xx_Child_Label_Name__c, those records won’t appear in the results. Only records with a value in the field defined by the Label Field API Name will be displayed.

Filter Condition Format

The following types of Here are the LWCs and the their related offline templates where this is relevant: 

  • manageIndicators

  • manageLogFrames

  • activities

  • Financials Excel Upload

  • Financials Excel Download

Configure lookup filter criterias:

  1. To add a new record for customization, navigate to “Setup” in the Quick Find box and enter “Custom Metadata Types”.

  2. Click on “Manage Records” to the left of the ampi__xx_Lookup_Filter_Label_Mapping__mdt CMDT.

    Image Added
  3. Populate the new record as follows:

    1. Label - Specify the label for this record to help identify what this record does e.g. Parent Activity on Add Activity Modal

    2. Source Component (Picklist) - Choose the component you want to apply the Label/ Filter to. It determines the component on which this custom metadata record works. e.g. Activity Add Popup

    3. Child Object Name: The API name of the object on which the lookup field exists, e.g. ampi__Activity__c

    4. Parent Object Name: The API name of the parent object in the lookup relationship, e.g. ampi__Activity__c.

    5. Lookup Field Name: The API name of the lookup field, e.g. ampi__Parent_Activity__c.

    6. Label Field on the Parent Object: The API name of the field to be displayed in the lookup dropdown, e.g. ampi__Label_Translated__c.

    7. Filter Condition: Define the filter criteria that should be used to show filtered values in the lookup dropdown (or the relevant column in the downloaded template).
      Accepted filter operators are as follows:

Data Type

Operator Label

Operator Value

Phone

EQUALS

=

NOTEQUALS

!=

CONTAINS

LIKE

NOTCONTAINS

NOT LIKE

Text Picklist

EQUALS

=

NOTEQUALS

!=

CONTAINS

LIKE

NOTCONTAINS

NOT LIKE

Date, Number, Currency, Percent

EQUALS

=

NOTEQUALS

!=

LESSTHAN

<

GREATERTHAN

>

LESSTHANEQUAL

<=

GREATERTHANEQUAL

>=

The following types of filter conditions are supported:

  1. Operator(Parent_Field_API, VALUE(Constant Value))

  2. Operator(Parent_Field_API, FIELD(Child_Field_API))

...

In the Add and Edit pop up modals, when using the operators LESSTHAN, GREATERTHAN, LESSTHANEQUAL, or GREATERTHANEQUAL with a Field-type filter, the field must be included in the modal and must contain a value. In the case of Value-type filter it works fine, irrespective.

The Filter Condition field follows a specific formatting. Supported condition types include:

...

:

AND Condition: AND(Condition1;Condition2)
Example: AND(EQUALS(

...

Type, FIELD(Account.Type)); EQUALS(

...

Status, FIELD(Account.

...

Status)))
The dropdown will only show those Accounts whose value matches with both the child Account Type and Status.

OR Condition: OR(Condition1;Condition2)
Example: OR(EQUALS(

...

Type, FIELD(Account.Type)); EQUALS(

...

Status, FIELD(Account.

...

Status)))
The dropdown will only show those Accounts whose value matches with either the child Account Type or Status.

Info

Conditions should be separated by a semicolon (;).

Simple Condition: Neither AND nor OR.
Example: EQUALS(

...

Supported Data Types and Operators

The following data types and their corresponding operators are supported for CMDT filters:

Data Type

Operator Label

Operator Value

Phone

EQUALS

=

NOTEQUALS

!=

CONTAINS

LIKE

NOTCONTAINS

NOT LIKE

Text Picklist

EQUALS

=

NOTEQUALS

!=

CONTAINS

LIKE

NOTCONTAINS

NOT LIKE

Date, Number, Currency, Percent

EQUALS

=

NOTEQUALS

!=

LESSTHAN

<

GREATERTHAN

>

LESSTHANEQUAL

<=

GREATERTHANEQUAL

>=

...

Name, VALUE(Acc1))

The dropdown will only show those Accounts whose name is “Acc1”

...

  1. Click ‘Save’.

Info

In Label Field on the Parent Object: xx_Child_Label_Name__c, please enter the API name using a supported data type. Supported Data Types include:

  1. Email

  2. Phone

  3. Picklist

  4. Text

  5. Text Area

  6. URL

  7. Lookup

Note

If there are no records with a value in the field specified by the Label Field on the Parent Object, those records won’t appear in the results. Only records with a value in the field defined by the Label Field API Name will be displayed.

Filter Validation and Limitations

  • Phone Data Type: Values must be passed in an unformatted way (e.g.,1234567891), but will be displayed as formatted (123) 456-7891.

  • Date Data Type:Values must follow the YYYY-MM-DD format.

  • Currency and Number Fields: If no value is provided during add/edit operations, the system defaults to 0 for comparisons.

  • Date Fields: If no value is entered, the system treats it as null during comparisons.

  • When using the Download/Upload template, only fields from the host object can be used as reference fields in filter criteria. e.g. When downloading Activities from the Implementation Plan record page, only fields from the Implementation Plan can be used as reference fields.

Usage Scenarios

...

  • When working with standard objects, we can directly use the object’s API name in the filter condition followed by .

...

  • [FieldName] for

...

  • Standard Lookup Field Traversal: Remove the "Id" from the lookup field API name (performing comparisons.

    • e.g.

    , CreatedById becomes CreatedBy.Name).Custom Lookup Field Traversal: Replace
    • Enter Account.Type or Account.ID as part of the filter condition to compare Account Type or Account ID.

  • When working with custom objects, we replace __c with __r ( followed by .[FieldName] for performing comparisons.

    • e.g.

    , ampi__Project__c becomes ampi__Project__r.Name).

Dynamic Search Filter (DSF) Component

The DSF supports only the Label Field API Name (xx_Child_Label_Name__c) for filtering. Only records with values in this field will appear in the lookup dropdown.

User Permissions

  • Editable Fields: Users can edit only the IsActive field and the Filter Condition.

  • Non-editable Fields: Remaining fields cannot be modified by the user.
    • Enter CustomObject_r.Name as part of the filter condition to compare the Custom Object’s Name.

  • When the Source Component is set to "Filters," the lookup dropdown will show relevant fields as labels, but users won't be able to filter the options.

    Image Added

Lookup Filter Label Mappings available on Amp Impact out of the Box:

should display lookups

Label

Purpose

Parent Activity on IP DL Excel

Activities from the same Implementation Plan are displayed in the LWC lookup dropdowns and the reference tab in the downloaded template

PI on Add Activity Modal

Project Indicators from the same Project should display are displayed in the LWC lookups lookup dropdown and the reference tab in the downloaded template

PI on Edit Activity Modal

Project Indicators from the same Project should display are displayed in the LWC lookups lookup dropdown and the reference tab in the downloaded template

PI on IP DL Excel

Project Indicators from the same Project should display are displayed in the LWC lookups lookup dropdown and the reference tab in the downloaded template

FO on Add Activity Modal

Framework Objectives from the same Project should display are displayed in the LWC lookups lookup dropdown and the reference tab in downloaded template

FO on Edit Activity Modal

Framework Objectives from the same Project

are displayed in the LWC

lookup dropdown and the reference tab in downloaded template

FO on IP DL Excel

Framework Objectives from the same Project should display are displayed in the LWC lookups lookup dropdown and the reference tab in downloaded template

Activity on Financial Plan DL Excel

Activities from the same Project should display are displayed in the planning Budget Planning template

Activity on Financial Report DL Excel

Activities from the same Project should display are displayed in the reporting Budget Reporting template

Budget on Financial Report DL Excel

Budgets from the same Project should display are displayed in the reporting template

...

Budget Reporting template

Info

Users can edit only the IsActive field and the Filter Condition for these records, they cannot modify the remaining fields.

When would you see an error:

  • Invalid Filter: An error is raised if the filter conditions are incorrect.

  • API Errors: Errors occur if any API referenced in the filter is unavailable.

  • Field Access Issues: If there is no access to a specified field in the filter, it will trigger an error.

  • LWC Components: If one filter fails, the default values will display, ignoring all other valid filters.

  • Download/Upload: If one filter fails, the remaining valid filters are still applied to their respective lookups.