Start a conversation

How to: Configure FindAsYouType

Summary

How to: Configure FindAsYouType

Question/Problem Description

This article explains howto configure FindAsYouType

Environment

CRM.designer

Resolution


A field is considered for FindAsYouType if one of these conditions is met:

  • The field is a link field (= Z-Field, NOT a linkED field from another info area!) and is not read only
  • The field has a "Select-Function" of type selectRecord defined in the Field Attributes

The FindAsYouType feature can be configured using:

  • the parameters of the selectRecord function by either
    • providing a query name
    • providing the fields to be searched and transferred to the details view
  • a query with name <InfoArea>.FindAsYouType, where <InfoArea> is the ID of the info area to be searched.
    • For all link fields (=Z-Fields) with target <InfoArea>, this query is used automatically if no other configuration is defined.

What does FindAsYouType do with the selected Record?

FindAsYouType only takes care of selecting a record and then hands this record over to the Select-Function, which takes care of further processing:

  • for link fields (Z-Fields), the function automatically sets the according link and thus the corresponding field gets updated.
  • for other fields, the Select-Function has to be configured explicitly to update the appropriate fields.

See HOWTO_Use_RecordSelector for further information.

Select-Function

The behaviour of FindAsYouType can be configured by providing selectRecord an argument object containing the property findAsYouType. The general structure should be:

selectRecord({
 from: {
  infoAreaId:"OJ"
 },
 findAsYouType: {
  searchFields:[3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
  textFields:[5,6,12],
  maxRows:20,
  query: "MyQueryName"
 }
});


Parameters
This section provides a detailed description of the parameters for FindAsYouType.

Name Type Description
infoAreaId string The ID of the info area to search in. Default if not set:  from.infoAreaId  property in the  selectRecord  argument object
searchFields OneOf{string,int}[] The field names/numbers to search in. Default if not set: parameter  textFields

The supported fieldtypes are:

  • Text
  • Numeric Fields
  • Variable Catalogs

When a field with a different type is used in the  searchFields , FindAsYouType is deactivated.

textFields OneOf{string,int}[] The field names/numbers used in the drop down for showing the results. Default if not set: parameter  searchFields .
maxRows int The maximum number of items to find. Default if not set:  8
query string The name of the query to use for findAsYouType. If this parameter is provided, the parameters  searchFields  and  textFields  are ignored.
 

Note : The argument object provided to selectRecord needs to contain at least from.infoAreaID, as this info area id is also used for FindAsYouType. See HOWTO_Use_RecordSelector for further information.

{
 from: { infoAreaId: "YourInfoAreaId" }
}


Examples


selectRecord({
 from: {
  infoAreaId:"OJ"
 },
 findAsYouType: {
  searchFields:[3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
  textFields:[5,6,12],
  maxRows:20
 }
});

selectRecord({
 from: {
  infoAreaId:"OJ"
 },
 findAsYouType: {
  maxRows:20
  query: "MyCustomQuery"
 }
});


Defining Queries for FindAsYouType

FindAsYouType can be configured by providing a query with filters either

  • by setting the query in the selectRecord argument as mentioned above, or
  • by naming the query <InfoAreaId>.FindAsYouType.

Every occurence of $parValue in the filters will be replaced by the text entered in the input field. The output fields of the query are used for showing the results in the dropdown.

Example
A query for companies: (users search field 2 = Company, the results contain fields 2 = Company, 3 = Synonym and 5 = Country)

SELECT (2, 3, 5) FROM (FI)
WHERE (F2="$parValue")


If this query is saved with the name FI.FindAsYouType, it is used as the default FindAsYouType query for all link fields referring to a FI record.

Configuration Order

As there are multiple ways to configure the FindAsYouType feature, there is a defined order for the evaluation. Let selectRecordOptions be the argument provided for the selectRecord function, then use the first rule that matches:

  • If selectRecordOptions.findAsYouType.query is defined, the query with the corresponding name is used.
  • If selectRecordOptions.findAsYouType.searchFields and/or selectRecordOptions.findAsYouType.textFields are defined, they are used.
  • If a query with the name <InfoArea>.FindAsYouType is defined, it is used.
  • If none of the rules above match, FindAsYouType is disabled.
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Priyanka Bhotika

  2. Posted

Comments