Skip to main content

Integration Guide — Extra Tables and Fields

Microservice: XDPeople.Soba.WebAPI (Core API)
Authentication: Bearer token (JWT) and tenant context — see Combined Login


Introduction

The extra tables and fields functionality allows defining, per entity type, a set of logical tables and fields with persistence in physical tables in the database, as well as values per entity instance (by primary key).

Two groups of endpoints cover distinct cases:

  1. Configuration — create, modify, and remove tables and fields; retrieve the complete configuration for the {entityTypeName} segment in the route.
  2. Values — read and write (upsert) extra values for one instance, identified by entityKeyId.

See Entity Type Identifier for supported {entityTypeName} values in routes.


Prefix and Routes

AreaURL Prefix
Configuration/gateway/extra-tables-fields-config/{entityTypeName}
Values/gateway/extra-fields-values/{entityTypeName}

The segments {entityTypeName} and {entityKeyId} must be URL-encoded when containing reserved characters.


Entity Type Identifier (entityTypeName)

The {entityTypeName} segment in the URL is the type identifier recognized by the server. The comparison is case-insensitive. Any other value returns ExtraTablesAndFields.UnsupportedEntityType.

entityTypeNameentityKeyId in values
AccountHeadingBEinteger
AccountTypeBEinteger
AdvancedDiscounttext up to 50 characters
BusinessAccountinteger
EntityContactsBEinteger
Entitytext up to 25 characters
EntityAddressinteger
EntityGroupsinteger
EntityTypesinteger
FixedExpensesAndRevenuesinteger
ItemBarcodeBEinteger
ItemBEtext up to 60 characters
ItemGroupBEinteger
LoadUnloadPlaceBEinteger
PointsConfigGUID
PriceTableinteger
SalesPromoBEinteger
SalesZoneinteger
UserBEinteger
UserGroupBEinteger
WarehouseBEinteger
XDfree01text up to 25 characters
XDfree02text up to 25 characters
XDfree03text up to 25 characters
XConfigCurrencyinteger
XConfigItemUnitinteger
XConfigPaymentModeinteger
XConfigPaymentTypeinteger

The entityTypeName field in the JSON body of the GET configuration corresponds to the value requested in the route.


Physical Table Name

For each logical table named Name and entity type entityTypeName, the physical table follows the pattern:

{Name}_{entityTypeName_lowercase}_extrafields

Example: logical table Extras with entityTypeName ItemBEExtras_itembe_extrafields.

This name appears in the configuration response as physicalTableName.


Endpoints — Configuration

Base: /gateway/extra-tables-fields-config/{entityTypeName}

MethodURLDescriptionSuccess Response
GET/gateway/extra-tables-fields-config/{entityTypeName}Lists tables and their respective fields.200 — body ExtraFieldsConfigurationResponse
POST/gateway/extra-tables-fields-config/{entityTypeName}/tablesCreates a logical table and the physical table.200 — created table body
PUT/gateway/extra-tables-fields-config/{entityTypeName}/tables/{tableGuid}Updates table metadata (does not change logical name).204
DELETE/gateway/extra-tables-fields-config/{entityTypeName}/tables/{tableGuid}Removes configuration, associated fields, and drops the physical table.204
POST/gateway/extra-tables-fields-config/{entityTypeName}/tables/{tableGuid}/fieldsCreates a field (physical column).200 — created field body
PUT/gateway/extra-tables-fields-config/{entityTypeName}/fields/{fieldGuid}Updates field metadata (does not change name or type).204
DELETE/gateway/extra-tables-fields-config/{entityTypeName}/fields/{fieldGuid}Removes the field and drops the column from the physical table.204

Configuration Body (GET /gateway/extra-tables-fields-config/{entityTypeName})

Main properties (JSON in camelCase):

PropertyTypeDescription
entityTypeNamestringSame as the identifier used in the request route segment (the server returns it back in the body).
tablesarrayLogical tables ordered in the response.

Each element of tables:

PropertyTypeDescription
guidstringUnique identifier of the table in the configuration.
ordernumberDisplay order (≥ 0).
namestringLogical table name (identifier).
descriptionstringDescriptive text (can be empty on creation).
permissionTypenumberSee Table Permissions.
allowInDocumentsbooleanPermission to use in documents.
allowMultipleRegistriesbooleanIf true, the table allows multiple records per entity; see Values per Instance.
physicalTableNamestringDatabase table name.
fieldsarrayTable fields.

Each element of fields:

PropertyTypeDescription
guidstringUnique identifier of the field.
ordernumberOrder (≥ 0).
namestringLogical column name.
descriptionstringDescription (mandatory on creation; 1–500 characters).
fieldTypestringLogical type; see Field Types.
lengthnumberFor String, maximum length; for Decimal, decimal places; otherwise follows server rules (1–16383).
requiredbooleanField required in configuration.
inactivebooleanIf true, the field is ignored when reading values.
tableNamestringLogical table name to which the field belongs.
valuesobjectIndex → text map (options when applicable).
canEditValuesbooleanWhether options are editable at runtime.
entityTypestring | nullTarget entity type for lookup-style field; optional.

Create Table (POST /gateway/extra-tables-fields-config/{entityTypeName}/tables)

PropertyRequiredRules
nameyes1–25 characters; first character letter; rest letters or digits (^[a-zA-Z][a-zA-Z0-9]*$).
descriptionyesUp to 2000 characters; can be empty string.
orderyes≥ 0.
permissionTypeyesBetween 0 and 2; see Table Permissions.
allowInDocumentsyesboolean
allowMultipleRegistriesyesboolean

The server validates the logical name and rejects creation if a physical table with the derived name already exists (ExtraTablesAndFields.PhysicalTableExists).

Update Table (PUT /gateway/extra-tables-fields-config/{entityTypeName}/tables/{tableGuid})

Body: description, order, permissionType, allowInDocuments, allowMultipleRegistries (the logical table name cannot be changed via this endpoint).

Create Field (POST /gateway/extra-tables-fields-config/{entityTypeName}/tables/{tableGuid}/fields)

PropertyRequiredRules
nameyesSame identifier rules as logical table name (1–25, initial letter).
descriptionyes1–500 characters.
orderyes≥ 0.
fieldTypeyesNon-empty string up to 16 characters; see Field Types.
lengthyes1–16383 (meaning depends on type).
requiredyesboolean
inactiveyesboolean
valuesyesObject with numeric keys and text values (can be {}).
canEditValuesyesboolean
entityTypenoUp to 32 characters; empty or omitted = no lookup.

Update Field (PUT /gateway/extra-tables-fields-config/{entityTypeName}/fields/{fieldGuid})

Body: description, order, length, required, inactive, values, canEditValues, entityType. The name and type of the field are not changed by this flow.

Table Permissions

Values of permissionType (aligned with internal enum):

ValueMeaning
0All users
1Current user
2User groups

Field Types

Typical values of fieldType on creation (internally mapped to CLR and DDL types):

fieldTypeSummary Usage
StringText; length = maximum text column length.
LongTextLong text
Int32Integer number.
DecimalDecimal; length = decimal places.
BooleanTrue/false.
DateTimeDate and time.
DateDate (stored as date/time).
GuidUnique identifier.
ImageImage

Unrecognized types tend to be treated as text.


Endpoints — Values per Instance

Base: /gateway/extra-fields-values/{entityTypeName}

MethodURLDescriptionSuccess Response
GET.../{entityKeyId}Returns all extra values applicable to the instance.200
PUT.../{entityKeyId}Writes values (upsert: inserts row if not existing, otherwise updates).204

Key Format

All keys in the values object use the format {logicalTableName}.{fieldName}, for example Extras.Notas.

Matching is case-insensitive on the key. Keys that do not correspond to any active field in a single-record table are ignored in PUT (do not cause error).

PUT Body

{
"values": {
"MyTable.TextField": "note",
"MyTable.DecimalField": 12.34,
"MyTable.BoolField": true
}
}

Conversion on Write

For each field, the server converts the received value according to the type:

fieldTypeTreatment
Int32Integer.
DecimalDecimal.
BooleanBoolean.
DateTime, DateDate/time (if received as text, interpreted on server).
OthersPersisted as text from the received value.

Null or missing JSON values may be persisted as SQL NULL depending on the column.

GET Body

The same structure { "values": { "Table.Field": ... } }. For boolean, integer, and decimal types, the response normalizes to native JSON types; for other types the returned value reflects what came from the database (e.g., dates as string or native value, depending on the database driver).


Errors (Stable Codes)

Issues are returned in the gateway HTTP error format; relevant business codes:

CodeTypical Situation
ExtraTablesAndFields.UnsupportedEntityTypeUnsupported entityTypeName.
ExtraTablesAndFields.InvalidTableNameInvalid table or field name per identifier rules (same code used for field name validation on creation).
ExtraTablesAndFields.TableNotFoundUnknown tableGuid for the type.
ExtraTablesAndFields.FieldNotFoundUnknown fieldGuid (or inconsistent parent table on deletion).
ExtraTablesAndFields.PhysicalTableExistsPhysical table with generated name already exists.
ExtraTablesAndFields.DdlFailedFailure applying DDL (create/alter structure).
ExtraTablesAndFields.SaveFailedFailure saving configuration metadata.
ExtraTablesAndFields.DeleteFailedFailure deleting table/field.
ExtraTablesAndFields.ReadValuesFailedFailure reading values.
ExtraTablesAndFields.SaveValuesFailedFailure writing values.

404 responses apply to missing table/field in configuration operations; 400 to entity type or payload validation; 500 to internal or DDL failures as mapped by the gateway.


Minimal Example (Configuration + Values)

  1. POST /gateway/extra-tables-fields-config/ItemBE/tables with body, for example:
{
"name": "Tabela",
"description": "Tabela 1",
"order": 2,
"permissionType": 0,
"allowInDocuments": false,
"allowMultipleRegistries": false
}
  1. With the returned table guid
    POST /gateway/extra-tables-fields-config/ItemBE/tables/cfbe5b29-5777-4c4a-84c3-68c065811ed7/fields.
{
"name": "Campo1",
"description": "Campo1 desc",
"order": 1,
"fieldType": "String",
"length": 255,
"required": true,
"inactive": false,
"values": {},
"canEditValues": false,
"entityType": "Entity"
}
  1. GET /gateway/extra-tables-fields-config/ItemBE — retrieve existing tables and fields (example for items).
{
"entityTypeName": "ItemBE",
"tables": [
{
"guid": "cfbe5b29-5777-4c4a-84c3-68c065811ed7",
"order": 2,
"name": "Tabela",
"description": "Tabela 1",
"permissionType": 0,
"allowInDocuments": false,
"allowMultipleRegistries": false,
"physicalTableName": "Tabela_itembe_extrafields",
"fields": [
{
"guid": "3d63058f-1df6-439e-9d9b-f04e55103d3c",
"order": 1,
"name": "Campo1",
"description": "Campo1 desc",
"fieldType": "String",
"length": 255,
"required": true,
"inactive": false,
"tableName": "Tabela",
"values": {},
"canEditValues": false,
"entityType": "Entity"
}
]
}
]
}
  1. Sending values PUT /gateway/extra-fields-values/ItemBE/3
{
"values": {
"Tabela.Campo1": "2"
}
}

Last updated: May 14, 2026