> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omni.co/llms.txt
> Use this file to discover all available pages before exploring further.

# allow_custom_fields

> Controls whether the AI can generate custom fields in its queries, based on user permission levels.

Controls whether the [Omni Agent](/ai/chat) and [Workbook Agent](/ai/queries) can generate custom fields in their queries. Custom fields are ad-hoc dimensions and measures that users can create in workbooks with their own calculations.

This setting only applies to AI-generated queries. Hand-written SQL is not affected by this setting.

<Warning>
  **Disabling custom fields is strongly discouraged.** It exists only for scenarios where only governed, model-based reporting is required.

  Omni does not run its AI evals in this mode. Additionally, custom fields are still governed by your model - this means that turning them off substantially limits the AI. Omni will not address reports of it failing to generate certain queries as a result.
</Warning>

## Syntax

```yaml theme={null}
ai_settings:
  allow_custom_fields: <always | never | not_for_restricted_queriers>
```

## Properties

<ParamField path="ai_settings" type="object">
  An object that contains various AI settings. See [`ai_settings`](/modeling/models/parameters/ai-settings) for more information.

  <Expandable title="ai_settings properties" defaultOpen="true">
    <ParamField path="allow_custom_fields" type="string" default="always">
      When the [Omni Agent](/ai/chat) and [Workbook Agent](/ai/queries) can generate custom fields in their queries. Does not apply to hand-written SQL.

      Must be one of the following:

      * `always` - **Default**. The AI can generate CTEs for all users, regardless of whether their role allows direct SQL access.
      * `never` - The AI cannot generate custom fields.
      * `not_for_restricted_queriers` - The AI can generate custom fields for all users with querying access except **Restricted Queriers**.

      <Tip>
        Plain column reference dimensions are allowed even when custom fields are disabled on CTEs. Computed dimensions and all measures will be rejected.
      </Tip>
    </ParamField>
  </Expandable>
</ParamField>

## Examples

ai\_settings:
allow\_custom\_fields: not\_for\_restricted\_queriers

````

```yaml title="Disable custom fields for all users"
ai_settings:
  allow_custom_fields: never
````

ai\_settings:
allow\_custom\_fields: not\_for\_restricted\_queriers
allow\_ctes: not\_for\_restricted\_queriers

```

See [`allow_ctes`](/modeling/models/parameters/ai-settings/allow-ctes) for more information.
```
