Document Search Custom Configuration
Summary
Surface provides multiple search components that help your users find their data quickly. You can refine these components' search options so your users get the most relevant data available at a glance.
If the out-of-the-box presets for these components don't meet your specific needs, you can use the information in this section to configure your own custom search options.
The following components support advanced custom configuration options:
- SAP Sales Doc Search
- SAP Invoice Search
- SAP Delivery Search
WARNING: All custom search criteria must first be configured using custom metadata before you can configure the search criteria within the component itself.
Search Criteria Metadata Configuration
All of the search criteria used by the search components can be configured via custom metadata.
This document includes information on how to configure each custom metadata type for a search component, including:
NOTE: All examples throughout this document reference Sales Doc Search, but the configurations for Delivery Search and Invoice Search are identical. You simply need to select the corresponding metadata types for those objects.
Find the Custom Metadata Configuration
- Navigate to Setup.
- Use the Setup Quick Find box to search for "Custom Metadata", then click the Custom Metadata Types link.
- Click on the metadata type that you want to configure. See the following sections for more information about each metadata type:
Presets
In order to provide a way to quickly change the search component configuration, every search component features a Preset. This contains all of the configuration specific to the search criteria for that particular document type.
- Out of the box, Surface ships with basic presets for each document that map the Customer Account Number to the document's Sold To field.
- You can create additional presets by opening up the Preset metadata type for a document and creating a new one.
NOTE: The Preset metadata types vary slightly for each document type, so look at the relevant documentation for that document search for a description of what each field does.
Find the Preset Metadata Type for a Document Type
- Navigate to Setup.
- Use the Setup Quick Find box to search for "Custom Metadata", then click the Custom Metadata Types link.
- Click on the Manage Records link to the left of the document type preset that you want to configure (example: click on SAP Sales Doc Search Preset or SAP Invoice Search Preset or SAP Delivery Search Preset).
- Select one of the out-of-the-box presets (example: click All Orders) OR create a new preset (click the New button).
Search Parameters
Every search parameter can be mapped to either:
- A static value
- A field on an sObject
- An SAP Customer Number
WARNING: Mapping a standard field more than once per type will cause unpredictable behavior. Typically**,** the most recently inserted field will take precedence.
TIP: See the following sections for more information on how to configure each Parameter Type.
Find a Search Parameter for a Document Type
- Navigate to Setup.
- Use the Setup Quick Find box to search for "Custom Metadata", then click the Custom Metadata Types link.
- Click on the Manage Records link to the left of the document type search parameter that you want to configure (example: click on SAP Sales Doc Search Preset Parameters).
- Click Edit next to the search parameter that you want to change OR click New to create a new search parameter.
Static Values
Use static values to specify a single, constant value that will be used as a parameter for every search performed with a specific preset.
Configure a Parameter Using a Static Value
- Follow the steps listed in Find a Search Parameter for a Document Type.
- Enter a label in the Label field.
- Select the preset that you're creating the parameter for.
- To configure a standard field, leave Is Custom unchecked and Custom Field Name blank (see the Custom Fields section to configure custom fields).
- Select the appropriate SAP Field for your parameter.
- Select Static Text from the Parameter Type drop-down.
- Leave Mapped Object and Mapped Field set to "--None--".
- Specify a value in the Static Value field.
sObject Fields
Mapped Fields let you to use a field from a related sObject as a search parameter.
Configure a Parameter Using a Mapped sObject Field
- Follow the steps listed in Find a Search Parameter for a Document Type.
- Enter a label in the Label field.
- Select the preset that you're creating the parameter for.
- To configure a standard field, leave Is Custom unchecked and Custom Field Name blank (see the Custom Fields section to configure custom fields).
- Select the appropriate SAP Field for your parameter.
- Select Mapped Field from the Parameter Type drop-down.
- Select the appropriate sObject from the Mapped Object drop-down (example: Account).
- Select the appropriate item from the Mapped Field that corresponds to your selection from the Mapped Object drop-down (example: Account Number).
- Leave the Static Value field blank.
SAP Customer Number
You can use the SAP Customer Number field as a search parameter.
Configure a Parameter Using an SAP Customer Number
- Follow the steps listed in Find a Search Parameter for a Document Type.
- Enter a label in the Label field.
- Select the preset that you're creating the parameter for.
- To configure a standard field, leave Is Custom unchecked and Custom Field Name blank (see the Custom Fields section to configure custom fields).
- Select the appropriate SAP Field for your parameter.
- Select SAP Customer Number from the Parameter Type drop-down.
- Leave Mapped Object and Mapped Field set to "--None--".
- Leave the Static Value field blank.
Defining Custom Search Input Fields
You can create search parameters that map to fields that are custom to your system.
TIP: You need to get the name of the custom field from your SAP administrator
Configure a Parameter Using Custom Fields
- Follow the steps listed in Find a Search Parameter for a Document Type.
- Enter a label in the Label field.
- Select the preset that you're creating the parameter for.
- Check the Is Custom box.
- In the Custom Field Name field, enter the SAP custom field name that you obtained from your SAP administrator.
- Select "--None--" from the SAP Field drop-down.
- Configure the remaining fields depending on the parameter type (see the Static Values / sObject Fields / SAP Customer Number sections for more information).
Sorting
You can specify sorting criteria via metadata mappings (example custom metadata type: SAP Sales Doc Search Preset Sort Field).
You need to specify 3 pieces of information:
- Precedence - Determines the order in which the field is sorted. Low numbers indicate the field will be used as the higher priority for sorting (example: "1" = higher priority over "2", etc.).
- Sort Field - The field to sort by
- Sort Direction - Whether to sort the field in ascending or descending order
- Ascending = A-Z OR Newest to Oldest
- Descending = Z-A OR Oldest to Newest
WARNING: Specifying multiple fields with the same precedence will cause unpredictable behavior as to which field gets sorted first.
- INCORRECT: "Field A" has Precedence = 1 AND "Field B" has Precedence = 1
- CORRECT: "Field A" has Precedence = 1 AND "Field B" has Precedence = 2
Specify Sorting Criteria for a Preset
- Navigate to Setup.
- Use the Setup Quick Find box to search for "Custom Metadata", then click the Custom Metadata Types link.
- Click on the Manage Records link to the left of the document type preset that you want to configure (example: click on SAP Sales Doc Search Preset Sort Field).
- Click Edit next to the sorting criteria that you want to change OR click New to create a new sorting criteria.
- Enter a label in the Label field.
- Select the preset that you want to sort.
- Enter a number in the Precedence field to indicate the sorting precedence.
- Select the field to sort by (example: Create Date).
- Select the desired sorting direction from the Sort Direction drop-down.
Filter By Document Type
You can specify the types of documents you want returned as a part of your search. Then add a record for every document type you want.
NOTE: If you don't specify any document types**,** you'll get all document types.
TIP: You need to get the specific SAP document code from your SAP administrator.
To Filter by Document Type
- Navigate to Setup.
- Use the Setup Quick Find box to search for "Custom Metadata", then click the Custom Metadata Types link.
- Click on the Manage Records link to the left of the document type preset that you want to configure (example: click on SAP Sales Doc Search Preset Doc Type).
- Click New to add a record for a document type you want to specify.
- Enter a label in the Label field.
- Select the preset for your search results.
- In the Doc Type Value field, enter the SAP document code that you obtained from your SAP administrator.
- Repeat the preceding steps (starting at "Click New to add a record") for each document type you want to specify for your search results.
Search Criteria Component Configuration
Search Criteria Selection
To specify the search criteria for a particular component, you need to select a Search Preset.
Each preset corresponds to a combination of search parameters and sorting information that**'**s configured in metadata.
TIP: For more detailed information on how to select an out of box or custom configured Preset for a specific component, see:
Custom Detail Pages
You can override the default Surface detail pages to redirect from the search page to your own custom detail page.
WARNING: You need to type the full name (including namespace) of your custom detail page into the box provided in order to override the Details link in the search results.
TIP: For more detailed information on where to override the default detail page link for a specific component, see:
Custom Field Visibility
You can configure which fields will be displayed to the users by using the Lightning App Builder. Up to 10 custom fields can be configured and set to be displayed in addition to standard fields.
Custom fields allow you to specify your own custom name for the column and can be found at the bottom of the list of available fields.
WARNING:
- These fields provide data that is specific to your organization. You need to confer with your SAP team to determine what data, if any, is returned in these fields.
- If you do not check Display Custom# Field then the value listed in the Rename Custom# Field text box and its results will NOT be displayed in your search results.
TIP: For more detailed information on where to set custom field visibility for a specific component, see: