# GetAdvancedSearchFields - Advanced Documentation ## When to Use Call this when you assemble a search from scratch (ad-hoc with `ExecuteAdvancedSearch`, or a saved search with `SaveAdvancedSearchFilters` / `SaveAdvancedSearchColumns`). It is the catalog of valid fields; do not guess field names or IDs. If an existing search already covers the request, copy from `GetAdvancedSearchFilters` / `GetAdvancedSearchColumns` instead. ## Overview Returns the fields of one entity that you can filter on (`IsColumnField` false) or show as result columns (`IsColumnField` true). Each entry is a `SearchField` ready to be copied into a `FieldList`. Results are cached per `FieldType`, `IsColumnField`, and firm. ## FieldType Values `FieldType` is a string naming the entity whose fields you want. It is case-insensitive and has no spaces (`ClaimTasks`, not `Claim Tasks`). Any other value throws `[] is not a valid AdvancedSearch.FieldType.` Allowed values (each one is an `AdvancedSearch.FieldType` enum member and has its own field-listing stored procedure): `Claim`, `ClaimContact`, `ClaimCorrespondence`, `ClaimCorrespondenceParticipants`, `ContactCorrespondence`, `ContactCorrespondenceParticipants`, `ClaimRequest`, `Contact`, `AddressTypeContact`, `AddressContact`, `PhoneTypeContact`, `PhoneContact`, `EmailTypeContact`, `EmailContact`, `ClaimLedger`, `ClaimNotes`, `ClaimGroup`, `Company`, `Lead`, `LeadIntegration`, `Persons`, `StaffRoles`, `ClaimEvent`, `ClaimTasks`, `ClaimDocuments`. Claim list and contact list fields are not listed here; they come from `GetAdvancedSearchFieldsClaimList` and `GetAdvancedSearchFieldsContactList`. Child entity fields (for example `ClaimRequest`, `ClaimNotes`, `ClaimDocuments`, `ClaimEvent`) used as columns make each result row one child record. See Row grain in `ExecuteAdvancedSearch` documentation. ## Copying Entries Into a FieldList Every returned entry carries `FieldName`, `DisplayName`, `FieldSource`, `FieldType`, `DataType`, `ID`, `NextEntityName`, `DropDownSourceFactory`, and `Description`. Copy an entry unchanged into a `FieldList`; do not edit `FieldType`, `DataType`, or `ID`. A `FieldList` is an ordered chain: - An entry with a non-empty `NextEntityName` is a link: it moves the chain into the entity that name points at. Call this endpoint again with that entity as `FieldType` to find the next entry. - The last entry (the leaf) has an empty `NextEntityName` and carries the `DataType`. Saving rejects a leaf that has a `NextEntityName`, or a leaf with no `DataType`. - A chain that stops on a link entry is malformed. Example: a phone number on a related contact must end at `PhoneContact.DisplayPhone`, not at `Contact.Phone`. Use `IsColumnField` true when copying entries into a column's `FieldList`, and false when copying into a filter's `FieldList`. ## Example ```javascript async () => { const claimFields = await SecureApi.GetAdvancedSearchFields("Claim", false); const leaf = claimFields.find(f => f.FieldName === "Status" && !f.NextEntityName); return leaf; } ```