Skip to main content

Custom Fields

CargoX enables the creation of custom fields and values for any entity, enhancing functionality across different modules. This feature allows you to extend the capabilities of entities by storing specific values in custom fields.

Naming Conventions

Follow these guidelines when naming custom fields:

  1. Use camel case for field names.
  2. For integration-specific fields, use camel case and prefix the field name with the module name. For instance, when integrating with a module like fedex, the field name should be fedexPickUpDate.

Examples of Custom Field Names:

  • pickUpDate
  • deliveryDate
  • invoiceNumber
  • trackingId
  • shipmentWeight
  • fedexPickUpDate
  • fedexDeliveryTime
  • upsTrackingId

Storage

Custom fields are stored in the customValues jsonb column of the entity. The key is the internal name of the custom field and the value is the value of the custom field.

Example 1: Basic Custom Field

{
"pickUpDate": "2024-01-01"
}

Example 2: Multiple Custom Fields

{
"pickUpDate": "2024-01-01",
"deliveryDate": "2024-01-05",
"invoiceNumber": "INV12345",
"trackingId": "TRK987654321",
"shipmentWeight": "150kg"
}

Example 3: Integration-Specific Fields

For integration-specific custom fields, ensure the field names are prefixed with the module name.

{
"fedexPickUpDate": "2024-01-01",
"fedexDeliveryTime": "15:00",
"upsTrackingId": "1Z999AA10123456784"
}