Enum fields

Some columns, arguments, or result values are enumeration values. GraphQL defines fields suffixed with AsEnum to handle them using native enumeration values.

Columns, as well as arguments and result values for processings and reports, have an associated domain for their value. This can be integer, decimal, string, or binary for example. However, there are cases when the domain is an enumeration type. Examples for this include the orderType for an order, or the finishType argument for the order finish processing.

In GraphQL, for every such column, parameter, or result whose value is an enumeration type, there are two fields available:

  • a field with the same name as the column, parameter, or result, which returns the value as the underlying integral type (e.g. orderType, finishType)
  • a field with the same name as the column, parameter, or result, but suffixed with AsEnum, which returns the value as an enumeration type (e.g. orderTypeAsEnum, finishTypeAsEnum)

The AsEnum fields enable you to define query without having to know what are the exact numerical values for a field and what they actually mean, since their meaning is defined by the name of enumeration values. For instance, the orgUnit1Processing to orgUnit12Processing fields have the following possible values:

Name Value
Blocked 0
InUse 1
Stop 2
Mandatory 3

These fields can be used as follows:

Query

mutation create_gla($cid : Int!, $no : Int!, $name : String!)
{
  useCompany(no: $cid)
  {
    generalLedgerAccount_create(values:[
      {
        accountNo : $no,
        name: "demo",
        orgUnit1ProcessingAsEnum : Mandatory
        orgUnit2ProcessingAsEnum : InUse
      }
    ])
    {
      affectedRows
      items {
        accountNo
        name
        shortName
        orgUnit1ProcessingAsEnum
        orgUnit2ProcessingAsEnum
        orgUnit3ProcessingAsEnum
        orgUnit1Processing
        orgUnit2Processing
        orgUnit3Processing
        editStatusAsEnum
      }
    }
  }
}
Result

{
  "data": {
    "useCompany": {
      "generalLedgerAccount_create": {
        "affectedRows": 1,
        "items": [
          {
            "accountNo": 12345,
            "name": "Demo",
            "shortName": "",
            "orgUnit1ProcessingAsEnum": "Mandatory",
            "orgUnit2ProcessingAsEnum": "InUse",
            "orgUnit3ProcessingAsEnum": "Blocked",
            "orgUnit1Processing": 3,
            "orgUnit2Processing": 1,
            "orgUnit3Processing": 0,
            "editStatusAsEnum": "Inserted"
          }
        ]
      }
    }
  }
}
Last modified January 30, 2025