TreeINFO-For-M365 documentation
    Preparing search index...

    Provides access to search data, form fields, and search-level operations.

    Available via tisa.search in search custom scripts.

    // Access search form fields (scoped to active tab)
    tisa.search.field.s_invoiceNumber.value = "INV-001";
    tisa.search.field.s_supplierName.hidden = true;

    // Read search state
    const results = tisa.search.results;
    const tab = tisa.search.activeTab;
    const searching = tisa.search.isSearching;

    // Trigger search programmatically
    await tisa.search.submit("QuickSearch");

    // Reset form
    tisa.search.reset();

    // Export results
    tisa.search.exportXLS();

    // Switch tab (by internal group name)
    tisa.search.setTab("Invoice_SearchAdvanced");

    Implements

    • ISearchService
    Index

    Accessors

    • get activeTab(): string

      Internal name (translation key) of the currently active tab. Corresponds to the Name property of the group in the web part configuration (with the RESX. prefix stripped). Locale-independent.

      Returns string

      if (tisa.search.activeTab === "Invoice_SearchBasic") {
      // do something for the basic tab
      }
    • get field(): Record<string, ISearchFieldService>

      Dictionary of search form fields for the active tab. Each field provides get/set for value, hidden, readOnly, required, and onChange subscription.

      Returns Record<string, ISearchFieldService>

      tisa.search.field.s_status.value = "Active";
      tisa.search.field.s_internal.hidden = true;
    • get isSearching(): boolean

      Whether a search is currently in progress.

      Returns boolean

      function btnExportEnabled() {
      return !tisa.search.isSearching
      && tisa.search.results && tisa.search.results.length > 0;
      }
    • get results(): undefined | SearchResultItem[]

      Last search result set (SharePoint items from all source lists, enriched with list context). Each item includes listId (GUID) and listUrl (server-relative) identifying the source list. Returns undefined when no search has been performed yet.

      Returns undefined | SearchResultItem[]

      const items = tisa.search.results;
      if (items) {
      tisa.log.info("Found " + items.length + " items");
      // Group by source list
      const byList = items.reduce((acc, item) => {
      (acc[item.listId] ??= []).push(item);
      return acc;
      }, {});
      }

    Methods

    • Internal

      Clear all onChange callbacks on every cached field. Called before onTabChange since each tab has its own form.

      Returns void

    • Exports the current search results to CSV.

      Returns void

      tisa.search.exportCSV();
      
    • Exports the current search results to Excel.

      Returns void

      tisa.search.exportXLS();
      
    • Internal

      Notify field onChange subscribers; called by SearchScriptProvider when form values change

      Parameters

      • fieldName: string
      • newValue: any
      • oldValue: any

      Returns void

    • Resets the search form to its default state (clears all field values). Equivalent to clicking the Reset button.

      Returns void

      tisa.search.reset();
      tisa.search.field.s_status.value = "Active";
      await tisa.search.submit("QuickSearch");
    • Switches the active tab by its internal name (translation key). Uses the same value as activeTab.

      Parameters

      • tabName: string

      Returns void

      tisa.search.setTab("Invoice_SearchAdvanced");
      
    • Programmatically triggers the search using current form field values. The optional triggerName is forwarded to onSearchComplete as the second argument.

      • Omitted or undefined -> triggerName = "code" in onSearchComplete
      • Standard Search button (internal) -> triggerName = "search"
      • Custom string -> forwarded as-is

      Parameters

      • OptionaltriggerName: string

      Returns Promise<void>

      tisa.search.field.s_status.value = "Active";
      await tisa.search.submit("QuickSearch");