Lookup Display Fields & Custom Metadata Types



Lookup Display Fields in Amp Impact

Lookup Display Fields allow organizations to define an alternative field to display in place of the default “Name” field typically shown in lookups and master-detail relationship fields. This is done by configuring Custom Metadata Type (CMDT) records under the ampi__Object_Lookup_Label_Mapping__mdt CMDT.

For example, if the “Name” field is an Auto-number field, you can use this CMDT to display a Label or Description field in the lookup/master-detail field in a popup instead of the Auto-Number name.

Here are the pages where this is relevant:

  • ManageIndicators as a Lightning Web Component

  • ManageFrameworks as a Lightning Web Component

  • activities as a Lightning Web Component

  • Financials Excel Upload/Download

  • Manage Frameworks Visualforce page


Configure CMDTs

  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__Object_Lookup_Label_Mapping__mdt CMDT.

  3. Populate the new record as follows:

    1. Label - The label of the CMDT record should follow the convention [Child Object Name] - [Lookup Field Name], e.g. Objective - Parent Objective.

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

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

    4. Lookup Field Name: The API name of the lookup field, e.g. ampi__Catalog_Objective__c.

    5. Label Field API Name (Field_To_Use__c): The API name of the field to be displayed in the dropdown, e.g. ampi__Label__c.

      1. Note that Field_To_Use__c is the field API name to be used for searching the record and displaying the value in the lookup field on the Visualforce page.

      2. The defined field cannot be a LongTextArea or RichTextArea field. If either field type is used as the Label Field for a relationship field in either of the Financial Excel Download field sets, the Excel Download will fail.

  4. [Optional] Configure a lookup filter using attributes of the label, operator, and value. Note that the lookup filter configuration only affects Financials Excel Upload/Download and the Manage Frameworks Visualforce page.

    1. Accepted filter operators are as follows:

      1. Equal

      2. Does not equal

      3. Less than

      4. Greater than

    2. For example, organizations may configure a lookup filter to ensure that the lookup only displays records related to the same Project. The value for the Filter field of the ampi__Object_Lookup_Label_Mapping__mdt record would then be:

{
"label": "ampi__Project__c",
"operator": "equals",
"value": "ampi__Project__c"
}

Amp Impact offers this use case for the Budget__c lookup on Financial records in its managed package.

  • Other examples Organizations may consider depending on their use case include:

    • ampi__Objective__c - Only display records whose parent ampi__Project__c is the same record as the parent ampi__Project__c of the ampi__Financial__c record's parent ampi__Budget__c or ampi__Reporting_Period__c

    • ampi__Project_Indicator__c - Only display records whose parent ampi__Project__c is the same record as the parent ampi__Project__c of the ampi__Financial__c record's parent ampi__Budget__c or ampi__Reporting_Period__c

    • ampi__Account__c - Only display Account records where ampi__Organization_Type__c = “Vendor”

5. Click “Save”

If a record under the ampi__Object_Lookup_Label_Mapping__mdt CMDT is not defined, then the default field displayed is the value from the Name field on the parent Object.

The following seven CMDT records on ampi__Object_Lookup_Label_Mapping__mdt are available out of the box in the Amp Impact managed package. Note that several of the CMDT records use the ampi__Label_Translated__c field instead of ampi__Label__c in the Label Field API Name so that the non-default language users who are leveraging the multi-language capability of Amp Impact can view the translated values in the lookup dropdown.

  1. Objective - Parent Project Objective: Below is a screenshot of this CMDT record with the lookup field ampi__Parent_Project_Objective__c on Project Objective (ampi__Objective__c).

2. Financial - Reporting Period: Below is a screenshot of this CMDT record with the lookup field ampi__Reporting_Period__c on Financial (ampi__Financial__c).

3. Financial - Activity: Below is a screenshot of this CMDT record with the lookup field
ampi__Activity__c on Financial (ampi__Financial__c).

4. Financial - Budget: Below is a screenshot of this CMDT record with the lookup field ampi__Budget__c on Financial (ampi__Financial__c).

5. Activity - Parent Activity: Below is a screenshot of this CMDT record with the lookup field ampi__Parent_Activity__c on Activity (ampi__Activity__c).

6. Activity - Project Indicator: Below is a screenshot of this CMDT record with the lookup field ampi__Project_Indicator__c on Activity (ampi__Activity__c).

7. Activity - Project Objective: Below is a screenshot of this CMDT record with the lookup field ampi__Project_Objective__c on Activity (ampi__Activity__c).