---
id: object/codeunit/2682
type: object
title: Codeunit 2682 "Data Search Events"
summary: Codeunit 2682 "Data Search Events" in DataSearch (Microsoft.Foundation.DataSearch). 12 events. Introduced in BC29, still in BC30.
tier: official
language: en
tags:
  - codeunit
  - datasearch
versions:
  introduced: "29"
  last_changed: null
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: 43f596f811c684365620359c22c5634ef7c600af83cf62119c33b705a2b787dc
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/DataSearch/app/DataSearchEvents.codeunit.al
    title: src/Apps/W1/DataSearch/app/DataSearchEvents.codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
object_type: codeunit
object_id: 2682
name: Data Search Events
namespace: Microsoft.Foundation.DataSearch
app: DataSearch
extends: null
first_version: "29"
last_version: "30"
present_in:
  - "29"
  - "30"
changed_in: []
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 12
  events: 12
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 0
  called_by: 0
  implements: 0
---

# Codeunit 2682 "Data Search Events"

> Codeunit 2682 "Data Search Events" in DataSearch (Microsoft.Foundation.DataSearch). 12 events. Introduced in BC29, still in BC30.

DataSearch · Microsoft.Foundation.DataSearch · BC29-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/DataSearch/app/DataSearchEvents.codeunit.al) · facts from BC29

## Properties

| Property | Value |
|---|---|
| SingleInstance | true |

## Events published

- `OnGetFieldNoForTableType(TableNo: Integer; var FieldNo: Integer)` (integration): Specifies the Field No. for the table type field. For example "Sales Header" would specify 1 = "Document Type"
- `OnGetParentTable(SubTableNo: Integer; var ParentTableNo: Integer)` (integration): Specifies the parent table if a table is a sub-table in a header/lines construct, such as Sales Line
- `OnGetSubTable(ParentTableNo: Integer; var SubTableNo: Integer)` (integration): Specifies the sub table if a table is a parent table in a header/lines construct, such as Sales Line / Sales Header
- `OnGetListPageNo(TableNo: Integer; TableType: Integer; var PageNo: Integer)` (integration): Specifies the list page no. to be used for displaying the record. Only needed if the page is not the standard list/card page for the table
- `OnGetCardPageNo(TableNo: Integer; TableType: Integer; var PageNo: Integer)` (integration): Specifies the card page no. to be used for displaying the record. If no card exists, then specify the list page no. Only needed if the page is not the standard list/card page for the table
- `OnMapLineRecToHeaderRec(var LineRecRef: RecordRef; var HeaderRecRef: RecordRef)` (integration): Specifies the header RecordRef to a corresponding line RecordRef for e.g. sales line -> sales header
- `OnAfterGetRolecCenterTableList(RoleCenterID: Integer; var ListOfTableNumbers: List of [Integer])` (integration): Enables adding and removing tables from the default initial setup for tables to search.
- `OnAfterGetFieldListForTable(TableNo: Integer; var ListOfFieldNumbers: List of [Integer])` (integration): Enables adding and removing fields from the default initial setup for fields for the specified table.
- `OnGetExcludedRelatedTableField(RelatedTableNo: Integer; var IsExcluded: Boolean)` (integration): Specifies whether a field is excluded from the default fields in a table, based on its table relation. Typically we would exclude fields from search that have relations to posting groups, reason codes, etc.
- `OnGetTableSubTypeFromPage(PageNo: Integer; var TableSubtype: Integer)` (integration): Specifies the table subtype for a page. Typically this means 'document type' for a specific table that is source table for the page.
- `OnBeforeSearchTable(var RecordRef: RecordRef)` (integration): Allows the addition of additional filters for the specified during the search.
- `OnBeforeSearchTableProcedure(TableNo: Integer; TableType: Integer; var FieldList: List of [Integer]; var SearchStrings: List of [Text]; var Results: Dictionary of [Text, Text]; var IsHandled: Boolean)` (integration): Allows the different implementation of the SerachTable procedure.

## Across versions

- Present in: BC29-30
- Changed (declaration) in: none

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "Data Search Events")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
