SearchContext
Defines a context-based search for linking records.
Use the SearchContext
attribute to configure a context-based search for
linking records. For further details, see Search Context.
If a SearchContext
is defined, users can select whether they want to
search for records in the whole database or within the current context when linking records
by using . Searching in the current
context only returns results that are linked to a parent record of the current record (e.g.
when linking a ticket to another ticket). Users get a drop-down list in the search mask
where they can select the Context (the list entries using the
default table caption of the corresponding record).
To configure the context-based search, define the SearchContext
attribute
for the Search control of the desired field group (i.e. the field group of the info area
where you want to search for records). This definition is used as a default for all link
fields to the respective info area. You can also define a search context within a specific
Select-Function
function. For further details, see Syntax.
Example
The search context defined for the Ticket info area (KM) {items:[null,"KP","FI"]}
is used when linking a ticket to an activity (MA), to another ticket or an installed base (IB).
The following info areas are involved:
-
<sourceInfoArea>:
the info area of the details mask (e.g. MA,IB or KM) -
<linkInfoArea>:
the info area used as the link record of the search (e.g. FI or KP) -
<infoArea>:
the info area from which a record is selected (e.g. KM)
Syntax
Define the SearchContext
attribute using the JSON syntax (See http://www.json.org):
{items:[<item1>,<item2>,...,null]}
where
<itemX> = <linkInfoArea>
or (complex version offering more possibilities like link ID and alternate label)
<itemX> = {infoAreaId:<linkInfoArea>,
linkId:<linkId>,sourceLinkId:<sourceLinkId>,
sourceLinkName:<sourceLinkName>,label:<label>}
Specify <itemX> = null
for searching the entire database.
The last entry provided in the SearchContext
attribute is the one selected by default in the Context drop-down list of the Search mask.
Available options:
|
The ID of the info area used as the link record for the search (e.g.
|
or
|
The link ID used to read the link record (e.g.
You always need to specify the |
|
The link's name in the format
e.g. |
|
Specifies an alternate label for the entry in the drop-down list, e.g.
If not specified, the default table caption is used. You can reference (multilingual) texts from the CRM.Designer database by
specifying |
|
Use this option if there is no direct link in the context for the desired info area, but it can be retrieved as a parent link of the linked record. Example (s. below): Getting only marketing activities (AK) linked to the same campaign (CM). |
sourceLinkId
and sourceLinkName
can only be used if the argument linkUid
(or searchUid
) is passed to the search page.Use the SDK page to test your definitions: Search > Search Form.
Examples:
{items:[null,"KP","FI"]}
… entire database, person, and company context (default selection)
{items:["FI","KP",{infoAreaId:"KP",linkId:2},null]}
… company, person (default link), person (Link ID 2), and entire database (default selection)
{items: ["FI"]}
... the search context is fixed, i.e. no drop-down list is displayed: the search returns only records linked to the parent company
To show all companies/persons to which the ticket is linked (both End Customer and Contact Company/Person) in the search context:
{
items: [
null,
{sourceLinkName: "$Link[KP:1]"},
{sourceLinkName: "$Link[KP:2]"},
{sourceLinkName: "$Link[FI:1]"},
{sourceLinkName: "$Link[FI:2]"}
]
}
For the same result you can specify:
{
items: [
null,
{infoAreaId: "KP", sourceLinkId: 1},
{infoAreaId: "KP", sourceLinkId: 2},
{infoAreaId: "FI", sourceLinkId: 1},
{infoAreaId: "FI", sourceLinkId: 2}
]
}
To search only for marketing activities linked to the same campaign or the entire database (in UPDATE_DEFAULT defined in the AN
Details control, Select-Function
of field Follow-up Marketing Activity):
{items: [{parentInfoAreaId: "AK", infoAreaId: "CM"},null]}