Custom fields

These events are emitted by the Inventory API (btrz-api-inventory) when custom fields are created or updated.

Events

Action Event name Endpoint
Create a custom field customfields.created POST /custom-fields
Update a custom field customfields.updated PUT /custom-fields/:fieldId

Payload example created

{
  "attemptId": "9287826c-04d1-46ab-acc8-4f49e73d160d",
  "created": 1623794394,
  "data": {
    "_id": "5ff377bbd383cf7df687fedc",
    "accountId": "52a377ec430c7d4e220001fc",
    "createdAt": {
      "offset": 0,
      "value": "2021-01-04T20:16:59.548Z"
    },
    "deleted": false,
    "fields": [
      {
        "disabled": "false",
        "internalId": "52a377ec430c7d4e220001fc-0",
        "options": [],
        "required": "false",
        "text": "dfasdf",
        "type": "1"
      }
    ],
    "modelName": "Transactions",
    "updatedAt": {
      "offset": 0,
      "value": "2021-06-15T21:59:52.439Z"
    },
    "userId": "55fc2f318791db6e1a0000b6"
  },
  "event": "customfields.created",
  "id": "f7cf105e-e83d-4986-8171-70ba5c6c57cd",
  "livemode": true
}

Field descriptions — data (customfields.created / customfields.updated)

Field Type Description
_id string Custom field id (24 hex characters).
accountId string Account (provider) id.
modelName string Model the custom field applies to: "Transactions" (sales flow) or "Stations" (sales operations).
deleted boolean Whether the custom field is marked deleted/inactive.
fields array List of field definitions (see below).
createdBy string User id that created this resource (24 hex).
updatedBy string User id that last updated this resource (24 hex).
createdAt object BzDate: date the object was created.
updatedAt object BzDate: date the object was last updated.
userId string (If present) User id associated with the resource.

fields (each item): internalId, required (boolean), disabled (boolean), text, type (1=Text, 2=Checkbox, 3=List), options (array of strings).

Payload example updated

{
  "attemptId": "9287826c-04d1-46ab-acc8-4f49e73d160d",
  "created": 1623794394,
  "data": {
    "_id": "5ff377bbd383cf7df687fedc",
    "accountId": "52a377ec430c7d4e220001fc",
    "createdAt": {
      "offset": 0,
      "value": "2021-01-04T20:16:59.548Z"
    },
    "deleted": false,
    "fields": [
      {
        "disabled": "false",
        "internalId": "52a377ec430c7d4e220001fc-0",
        "options": [],
        "required": "false",
        "text": "dfasdf",
        "type": "1"
      }
    ],
    "modelName": "Transactions",
    "updatedAt": {
      "offset": 0,
      "value": "2021-06-15T21:59:52.439Z"
    },
    "userId": "55fc2f318791db6e1a0000b6"
  },
  "event": "customfields.updated",
  "id": "f7cf105e-e83d-4986-8171-70ba5c6c57cd",
  "livemode": true
}

(Field descriptions for data are the same as for customfields.created above.)