# Data field

Data fields are contract variables (also known as placeholders, custom fields, tags, etc.) that you can use in contract product tables, text and image, and form sections.

You can set the values for the data fields in a [contract](oneflow-platform-glossary#contract) or at the [template type](oneflow-platform-glossary#template-type) level. The behavior of these two operations is different, so it is important to understand the difference. Please, see the [Create a contract with data fields](create-a-contract-with-data-fields) tutorial for more information.

# Data field attributes

The table below displays all the attributes available for each data field:

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Attribute
      </th>

      <th>
        Type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        * links
      </td>

      <td>
        [object](type-reference#base-types)
      </td>

      <td>
        Contains links to endpoints associated with this data field. See [Data fields links](#data-fields-links).
      </td>
    </tr>

    <tr>
      <td>
        active
      </td>

      <td>
        [boolean](type-reference#base-types)
      </td>

      <td>
        Indicates whether the data field is active. 

        * \*Note:\*\* Only active data fields can be used in a contract or template.
      </td>
    </tr>

    <tr>
      <td>
        custom\_id
      </td>

      <td>
        [string](type-reference#base-types)
      </td>

      <td>
        A custom identifier you can use to address the data field through the API. Each `custom_id` must be unique within the same template type.
      </td>
    </tr>

    <tr>
      <td>
        description
      </td>

      <td>
        [string](type-reference#base-types)
      </td>

      <td>
        The description of the data field.
      </td>
    </tr>

    <tr>
      <td>
        id
      </td>

      <td>
        [integer(signed\_integer\_id)](type-reference#subtypes-for-int)
      </td>

      <td>
        The ID of the data field.
      </td>
    </tr>

    <tr>
      <td>
        name
      </td>

      <td>
        [string](type-reference#subtypes-for-str)
      </td>

      <td>
        A short descriptive name for the data field.
      </td>
    </tr>

    <tr>
      <td>
        placeholder
      </td>

      <td>
        [string](type-reference#subtypes-for-str)
      </td>

      <td>
        Placeholder text displayed in the data field UI when the value is absent.
      </td>
    </tr>

    <tr>
      <td>
        source
      </td>

      <td>
        [string(enum)](type-reference#subtypes-for-str)
      </td>

      <td>
        Indicates the source of the data field. See [Source](#source).
      </td>
    </tr>

    <tr>
      <td>
        value
      </td>

      <td>
        [string](type-reference#subtypes-for-str)
      </td>

      <td>
        The value of the data field. Text values are limited to 1024 characters.\
        If the data field's type is a checkbox, then the value can be 0 (false) or 1 (true). See [Value](data-field#value).
      </td>
    </tr>
  </tbody>
</Table>

### Data fields links

The `_links` object contains links to the endpoints associated with the data fields.

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Attribute
      </th>

      <th>
        Type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        template\_type
      </td>

      <td>
        [object](type-reference#base-types)
      </td>

      <td>
        The link to the [`Get template type`](/reference/get-template-type-by-id) endpoint. See [Links](contract#links).
      </td>
    </tr>
  </tbody>
</Table>

### Source

<Table align={["left","left"]}>
  <thead>
    <tr>
      <th>
        Source
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        user
      </td>

      <td>
        Indicates that the data field was created by a [user](oneflow-platform-glossary#user) either via the API or via the Oneflow application.
      </td>
    </tr>

    <tr>
      <td>
        system
      </td>

      <td>
        Indicates that the data field was created and is used by one of the integration extensions.
      </td>
    </tr>
  </tbody>
</Table>

> ❗️ Note:
>
> Data fields where `source=system` cannot be updated.  An attempt to update such data fields will return a 200 OK response, but the attribute will not be updated.

### Value

<Table align={["left","left"]}>
  <thead>
    <tr>
      <th>
        Input type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        checkbox
      </td>

      <td>
        If the data field attribute value is `0`, it is considered `false`, and the checkbox will be displayed as unchecked.\
        If the data field attribute value is `1`, it is considered `true`, and the checkbox will be displayed as checked.
      </td>
    </tr>
  </tbody>
</Table>