# GetAdvancedSearchColumns - Advanced Documentation ## When to Use Call this before writing any script that aggregates or filters advanced search results. The column list tells you, before the expensive run, whether the search contains what was asked for, what the object keys will be, and each column's datatype. Reading `Columns` off the results response is too late - the aggregation expressions are already written by then, and a guessed column name produces a confidently wrong number instead of an error. ## Overview Returns the column definitions for a saved advanced search as a list of `SearchColumnInfo`. Read-only - takes the `AdvancedSearchID` and changes nothing. ## Shape Each `SearchColumnInfo` carries: - **DisplayName** - the column's display name. This is the object key produced by `Helpers.toSearchResultObjects`, so the string in `r['...']` must match it exactly. A wrong key yields `undefined`, and aggregating `undefined` produces a wrong number instead of an error. - **FieldList** - an ordered chain of `SearchField` entries walking the entity path. Non-leaf entries carry `NextEntityName` pointing at the next entity in the chain. **The final entry is the leaf, and the leaf carries the `DataType` and `FieldName`** - read them from the last entry - `FieldList.at(-1)` in scripts - never the first entry. - **AggregateFunction**, **SortDirection**, **Width**, **Format**, **UID**, **FieldPath** - presentation and ordering details. ## DataType Vocabulary `DataType` is a fixed vocabulary, not free text: `Yes/No`, `Date`, `DateOfBirth`, `DateTime`, `TextShort`, `TextLong`, `Number`, `Decimal`, `Dropdown`, `ReasonForReferrals`, `ReasonForRejections`, `ReasonForStopChases`, `ClaimRanks`, `ClaimTypes`, `ContactTypes`, `HowDidYouHearAboutUsOptions`, `LedgerTypes`, `RequestTemplates`, `RequestTypes`, `NoteTypes`, `ClaimRole`, `ClaimStaff`, `Staff`, `Document`, `Tags`, `State`, `Hyperlink`, `Image`. ## Feeding ExecuteAdvancedSearch The list this returns is exactly the `Columns` parameter shape for `ExecuteAdvancedSearch`. Fetching the columns of an existing search, adjusting them, and executing ad-hoc is the supported path - the endpoint consumes this endpoint's output unchanged. See `ExecuteAdvancedSearch` documentation for the full workflow.