# SaveAdvancedSearchFilters - Advanced Documentation ## When to Use Use this to store the filter tree of a saved search you can edit: one you created, or a firm search when you hold the firm permission. To run a search without saving anything, use `ExecuteAdvancedSearch` instead. See the workflow at the top of `GetAdvancedSearchResults` documentation. ## Overview Replaces the whole saved filter tree of one search with the `FilterGroupInfo` you pass, and returns the tree you passed. Nothing is merged: send the complete tree every time. Fetch the current tree with `GetAdvancedSearchFilters`, change it, and send it back. ## Permissions - The caller needs ManageAdvancedSearch. - A firm search (`IsFirmAdvancedSearch`) also needs ManageFirm. - A search that is not a firm search can only be edited by the person who created it. - A search that is a shortcut to another search cannot have its filters updated. Failures throw a `RadoloException` with a plain message (for example `You do not have permission to edit advanced searches. Please contact your administrator.`). ## What Is Required - `AdvancedSearchID` must be 1 or greater: `Search filters must have an associated advanced search.` - The root must have at least 1 child: `A search filter must have at least 1 condition.` An empty tree is rejected here; it does not mean "all rows". - A child with a `FieldList` is a condition. A child without one is a group, and a group must have its own `Children` and an `and` / `or` `Condition`. - Every entry in a condition's `FieldList` needs `FieldName`, `FieldSource`, `DisplayName`, and `FieldType`. The last entry (the leaf) also needs `DataType`, must not have a `NextEntityName`, and needs an `Operator`. - Unless the operator is `Is Blank` or `Is Not Blank`, the leaf must fill the value slot its `DataType` and `Operator` read (for example text needs a non-empty `ValueString`, a list operator needs at least 1 list item, `Between Inclusive` needs both ends with start not above end). Slot by `DataType` and `Operator`: see the Required Slot table in `GetAdvancedSearchResults` documentation. Copy field entries from `GetAdvancedSearchFields` and the operator and value shapes from a saved search returned by `GetAdvancedSearchFilters`. ## Example ```javascript async () => { const tree = await SecureApi.GetAdvancedSearchFilters(advancedSearchId); // change one value in place, keep everything else as it arrived return await SecureApi.SaveAdvancedSearchFilters(advancedSearchId, tree); } ```