---
title: "Bitflags"
description: "Bitflags allow managing preferences and statuses using bit flags in integer columns. GraphQL queries and mutations simplify interacting with these fields."
lang: en
languages:
  en: https://docs.vismasoftware.no/businessnxtapi/apireference/schema/bitflags/index.md
lastmod: 2026-07-10
---

> Documentation index: https://docs.vismasoftware.no/businessnxtapi/apireference/schema/llms.txt


# Bitflags

Last modified July 10, 2026

> Bitflags allow managing preferences and statuses using bit flags in integer columns. GraphQL queries and mutations simplify interacting with these fields.


Some table columns store various preferences, statuses, or other kind of data that is defined using bit flags. These columns have the type `Int`.
Working with them directly, however, requires good knowledge of the corresponding bitflags (both their value and their meaning).
To ease this scenarios, all such columns have a corresponding columns with the same name but suffixed with `Flags`, which is defined as an array of an enumeration.

An example of such a column is `OrderPreferences` from the `Order` table. It can store a combination of the following flags:

| Name | Value | Description |
| ---- | ----- | ----------- |
| CreditNote | 2 | Credit note |
| BatchInvoice | 4 | Batch invoice |
| JustifyExchangeRates | 8 | Justify exchange rate |
| ExemptFromInvoiceFee | 16 | Exempt from invoice fee |
| GrossOrder | 256 | Gross order |
| ReserveOnSave | 512 | Reserve on save |
| AcceptChangesManually | 1024 | Accept changes manually |
| ReservationWithinLeadTime | 2048 | Reserve within lead time |
| ProduceCid | 4096 | Produce CID code |
| PickWholeOrder | 8192 | Pick complete order |
| InvoiceNoFromLabel | 16384 | Invoice no. from 'Label'. |
| DeductFromClientBankAccount | 32768 | Withdrawal from client bank account |
| PostToClientBankAccount | 65536 | Post to client bank account |
| UseClientResponsibility2 | 131072 | Use client responsibility 2 |
| FreeOfInterest | 262144 | Ref. Entry Free of interest |
| Prepayment | 524288 | Prepayment |
| FreeOfReminderFee | 1048576 | Ref. Entry Free of reminder fee |
| DontCopyFromRemittanceSupplier | 2097152 | Do not copy from payment supplier |
| UseClientResponsibility3 | 4194304 | Use client responsibility 3 |
| ExcludeFromReduplication | 8388608 | Exclude from reduplication |
| DontMoveConfirmedDeliveryDateEarlier | 16777216 | Do not move confirmed delivery date to earlier |
| UseOriginalExchangeRateOnCreditNotes | 33554432 | Use original exchange rate on credit notes |

In the GraphQL schema, the following two fields are available, for the `OrderPreferences` column:

![OrderPreferences](https://docs.vismasoftware.no/businessnxtapi/apireference/schema/bitflags1.png)

The field `orderPreferences` is an integer, while the field `orderPreferencesFlags` is an array of the enumeration type `OrderPreferencesDomain`, shown below:

![OrderPreferences](https://docs.vismasoftware.no/businessnxtapi/apireference/schema/bitflags2.png)

We can query these fields as follows:

```graphql { title = "Query" }
query read_order_preferences($cid : Int!)
{
  useCompany(no: $cid)
  {
    order
    {
      items
      {
        orderPreferences
        orderPreferencesFlags
      }
    }
  }
}
```

```graphql { title = "Result" }
{
  "data": {
    "useCompany": {
      "order": {
        "items": [
          {
            "orderPreferences": 16640,
            "orderPreferencesFlags": [
              "GrossOrder",
              "InvoiceNoFromLabel"
            ]
          },
          {
            "orderPreferences": 0,
            "orderPreferencesFlags": []
          },
          ...
        ]
      }
    }
  }
}
```

The bitflags can be used when inserting new records or when updating an existing record. This is shown in the next examples:

```graphql { title = "Query" }
mutation insert_order($cid: Int)
{
  useCompany(no: $cid)
  {
    order_create(values: [
      {
        orderPreferencesFlags : [
          GrossOrder,
          PickWholeOrder,
          FreeOfReminderFee
        ]
      }
    ])
    {
      affectedRows
      items
      {
        orderNo
        orderPreferences
        orderPreferencesFlags
      }
    }
  }
}
```

```graphql { title = "Result" }
{
  "data": {
    "useCompany": {
      "order_create": {
        "affectedRows": 1,
        "items": [
          {
            "orderNo": 4498,
            "orderPreferences": 1057024,
            "orderPreferencesFlags": [
              "GrossOrder",
              "PickWholeOrder",
              "FreeOfReminderFee"
            ]
          }
        ]
      }
    }
  }
}
```

```graphql { title = "Update" }
mutation update_order($cid: Int, $ono : Int!)
{
  useCompany(no: $cid)
  {
    order_update(
      filter : {orderNo : {_eq : $ono}},
      value: {
        orderPreferencesFlags : [
          GrossOrder,
          InvoiceNoFromLabel
        ]
      })
    {
      affectedRows
      items
      {
        orderNo
        orderPreferences
        orderPreferencesFlags
      }
    }
  }
}
```

```graphql { title = "Result" }
{
  "data": {
    "useCompany": {
      "order_update": {
        "affectedRows": 1,
        "items": [
          {
            "orderNo": 4498,
            "orderPreferences": 16640,
            "orderPreferencesFlags": [
              "GrossOrder",
              "InvoiceNoFromLabel"
            ]
          }
        ]
      }
    }
  }
}
```

To reset (erase) all the bitflags of a column, you can choose between:

- Using the integer column and set the value to `0` (e.g. `orderPreferences : 0`).
- Using the flags column and set the value to an empty array, i.e. `[]` (e.g. `orderPreferencesFlags : []`). This second option is exemplified next:

```graphql { title = "Update" }
mutation update_order($cid: Int, $ono : Int!)
{
  useCompany(no: $cid)
  {
    order_update(
      filter : {orderNo : {_eq : $ono}},
      value: {
        orderPreferencesFlags : []
      })
    {
      affectedRows
      items
      {
        orderNo
        orderPreferences
        orderPreferencesFlags
      }
    }
  }
}
```

```graphql { title = "Result" }
{
  "data": {
    "useCompany": {
      "order_update": {
        "affectedRows": 1,
        "items": [
          {
            "orderNo": 4498,
            "orderPreferences": 0,
            "orderPreferencesFlags": []
          }
        ]
      }
    }
  }
}
```

The bitflag fields can also be used in filters, with one of the following operators:

| Operator | Description |
| -------- | ----------- |
| `_is_on` | The specified flag is active (present among the enabled flags). |
| `_is_off` | The specified flag is not active (not present among the enabled flags). |
| `_eq` | The column value is set to exactly the specified flag (the specified flag is the only one that is active). |
| `_not_eq` | The column valus is not set to exactly the specified flag. |

An example is used in the following snippet:

```graphql { title = "Query" }
query read_order($cid: Int)
{
  useCompany(no: $cid)
  {
    order(filter : {
      orderPreferencesFlags : {_is_on : GrossOrder}})
    {
      totalCount
      items
      {
        orderNo
        orderPreferences
        orderPreferencesFlags
      }
  }
}
```

```graphql { title = "Result" }
{
  "data": {
    "useCompany": {
      "order": {
        "totalCount": 10,
        "items": [
          {
            "orderNo": 132,
            "orderPreferences": 16640,
            "orderPreferencesFlags": [
              "GrossOrder",
              "PostToClientBankAccount"
            ]
          },
          ...
        ]
      }
    }
  }
}
```

Flags can be provided as a variable as shown in the following examples:

```graphql { title = "Update" }
mutation update_order($cid: Int,
                      $ono : Int!,
                      $opf : [OrderPreferencesDomain])
{
  useCompany(no: $cid)
  {
    order_update(
      filter : {orderNo : {_eq : $ono}},
      value: {
        orderPreferencesFlags : $opf
      })
    {
      affectedRows
      items
      {
        orderNo
        orderPreferences
        orderPreferencesFlags
      }
    }
  }
}
```

```graphql { title = "Variables" }
{
  "cid" : 123456789,
  "ono" : 42,
  "opf": [
    "GrossOrder",
    "PickWholeOrder",
    "FreeOfReminderFee"
  ]
}
```

```graphql { title = "Update" }
mutation update_order($cid: Int,
                      $ono : Int!,
                      $ord : Order_Input!)
{
  useCompany(no: $cid)
  {
    order_update(
      filter : {orderNo : {_eq : $ono}},
      value: $ord)
    {
      affectedRows
      items
      {
        orderNo
        orderPreferences
        orderPreferencesFlags
      }
    }
  }
}
```

```graphql { title = "Variables" }
{
  "cid" : 12345678,
  "ono" : 42,
  "ord": {
    "orderPreferencesFlags" : [
      "GrossOrder",
      "PickWholeOrder",
      "FreeOfReminderFee"
    ]
  }
}
```

## Setting and clearing individual bits

It is possible to set or clear individual bits (flags) without affecting the other bits, by using several special fields that are available for each bitflag column:

- a field named `<columnname>SetOn` (such as `orderPreferencesSetOn`), of an integer type, that can be used to set one or more bits (flags) on the column, without affecting the other bits
- a field named `<columnname>SetOff` (such as `orderPreferencesSetOff`) , of an integer type, that can be used to clear one or more bits (flags) on the column, without affecting the other bits
- a field name `<columnname>FlagsSetOn` (such as `orderPreferencesFlagsSetOn`), of an array of enumeration type, that can be used to set one or more bits (flags) on the column, without affecting the other bits
- a field name `<columnname>FlagsSetOff` (such as `orderPreferencesFlagsSetOff`), of an array of enumeration type, that can be used to clear one or more bits (flags) on the column, without affecting the other bits

Examples for using these fields are shown below:

```graphql { title = "Update" }
mutation set_on($cid: Int, $ono: Int!)
{
  useCompany(no: $cid) {
    order_update(
      filters: [{ orderNo: { _eq: $ono } }],
      values: [{ orderPreferencesSetOn: 20480 }]
    )
    {
      affectedRows
      items
      {
        orderNo
        orderPreferences
      }
    }
  }
}
```

```graphql { title = "Update" }
mutation set_on($cid: Int, $ono: Int!)
{
  useCompany(no: $cid) {
    order_update(
      filters: [{ orderNo: { _eq: $ono } }],
      values: [{ orderPreferencesSetOff: 256 }]
    )
    {
      affectedRows
      items
      {
        orderNo
        orderPreferences
      }
    }
  }
}
```

The `setOn` and `setOff` fields can be used at the same time, except that:

- They cannot set and clear the same bit (flag) at the same time.
- They cannot be used together with the base field (for instance set both `orderPreferences` and `orderPreferencesSetOn` in the same operation).

If any of these happens, an error occurs and the operation is not performed.

```graphql { title = "Update" }
mutation set_on($cid: Int, $ono: Int!)
{
  useCompany(no: $cid) {
    order_update(
      filters: [{ orderNo: { _eq: $ono } }],
      values: [{ 
        orderPreferencesSetOn: 20480
        orderPreferencesSetOff: 256
      }]
    )
    {
      affectedRows
      items
      {
        orderNo
        orderPreferences
      }
    }
  }
}
```

The examples previously shown can be rewritten using the `FlagsSetOn` and `FlagsSetOff` fields, which are more readable:

```graphql { title = "Update" }
mutation set_on($cid: Int, $ono: Int!)
{
  useCompany(no: $cid) {
    order_update(
      filters: [{ orderNo: { _eq: $ono } }],
      values: [{ orderPreferencesFlagsSetOn: [ProduceCid, InvoiceNoFromLabel] }]
    )
    {
      affectedRows
      items
      {
        orderNo
        orderPreferencesFlags
      }
    }
  }
}
```

```graphql { title = "Update" }
mutation set_on($cid: Int, $ono: Int!)
{
  useCompany(no: $cid) {
    order_update(
      filters: [{ orderNo: { _eq: $ono } }],
      values: [{ orderPreferencesFlagsSetOff: [GrossOrder] }]
    )
    {
      affectedRows
      items
      {
        orderNo
        orderPreferencesFlags
      }
    }
  }
}
```

```graphql { title = "Update" }
mutation set_on($cid: Int, $ono: Int!)
{
  useCompany(no: $cid) {
    order_update(
      filters: [{ orderNo: { _eq: $ono } }],
      values: [
        {
          orderPreferencesFlagsSetOn: [ProduceCid, InvoiceNoFromLabel],
          orderPreferencesFlagsSetOff: [GrossOrder]
        }]
    )
    {
      affectedRows
      items
      {
        orderNo
        orderPreferencesFlags
      }
    }
  }
}
```

You can also set and clear individual bits when using extensions. In this case, use the `setOn` and `setOff` fields. An example (equivalent for the previous query) is shown in the following snippet:

```graphql { title = "Update" }
mutation set_on($cid: Int, $ono: Int!)
{
  useCompany(no: $cid) {
    table_update(
      name : "order",
      filters: [{ 
        column: "orderNo",
        integerValue: { _eq: $ono }
      }],
      values: [{ 
        column: "orderPreferences",
        setOn: 20480,
        setOff: 256
      }]
    )
    {
      affectedRows
      items
      {
        orderNo : integerValue
        orderPreferences : integerValue
      }
    }
  }
}
```

---

[View this page](https://docs.vismasoftware.no/businessnxtapi/apireference/schema/bitflags/)
