Skip to Content
Droot Developers

Company-Specific Fields

Fields used only in some companies, or required, labelled or defaulted differently per company.

In a group of companies, the same record type often needs different fields in different companies: a GST number only in the Indian company, a required cost centre in one company and an optional one in another, a smaller list of choices where a company doesn't sell everything. A field keeps one definition for the whole group (its key, type, storage, lookup target and calculation). What varies by company is whether the field is used there and how it behaves.

This page is what an administrator, a customisation and an app developer need to know: the two field properties, how a company is resolved, what each part of the platform does with them, and the limits.

The two properties

Both sit on the field (fields.json, the define-field route, Setup › Customize › Models › the field › Companies). On an app's field they are a tenant customisation, like a label or a condition.

companies: where the field is used

{ "modelKey": "sales.invoice", "fieldKey": "gstin", "label": "GSTIN", "type": "text", "companies": ["acme-in"] }

A list of company keys (entity keys). Absent or null means every company. A listed company also covers its sub-companies (the group hierarchy) and its plants and branches (their legal entity).

In a company that doesn't use the field:

  • forms, lists, filters and the import template leave it out;
  • describe_records_model (Droot AI and MCP) doesn't describe it;
  • a save that sets it is refused with 400 Field "gstin" is not used in company "acme-uk". This applies to every writer: the API, imports, automations, scripts and Droot AI. A blank value, an unchanged value and an untouched default are not refused;
  • it is never required;
  • values already stored are kept, and reports, exports and the audit still read them. Other companies' records simply hold no value.

companySettings: how the field behaves per company

{
  "fieldKey": "costCentre", "label": "Cost Centre", "type": "select", "options": ["admin", "sales", "plant", "rnd"],
  "companySettings": {
    "acme-in": { "required": true, "label": "Cost Centre (Mandatory)" },
    "acme-uae": { "options": ["admin", "sales"], "defaultValue": "sales" }
  }
}

Per company key, only the properties that differ there:

Property What it changes
label, help, placeholder What people read
required, requiredWhen Required in that company (checked on every write)
readOnly, readOnlyWhen Read-only for people in that company
visibleWhen Shown or hidden in that company's forms
defaultValue or defaultExpression The default of a new record in that company
pattern, patternMessage The pattern a text value must match there
options A select's or multi-select's choices offered there: a subset of the field's

Everything else is the field as defined for every company. Each value is checked as the field's own would be: a default the field accepts, a condition that gives true or false, a pattern that compiles, options the field has. A value a record already holds stays allowed when a company narrows the options.

Inheritance. A company key covers its sub-companies, plants and branches. When several entries cover a company, the nearest wins, property by property: the company itself first, then the smallest group of companies that covers it, then the field as defined. This is the same rule Settings use.

Table columns

A table field's columns (an order's lines, a claim's expenses) take the same two properties, per column:

{
  "fieldKey": "lines", "label": "Lines", "type": "table",
  "columns": [
    { "key": "item", "label": "Item", "type": "text" },
    { "key": "hsn", "label": "HSN Code", "type": "text", "companies": ["acme-in"] },
    { "key": "centre", "label": "Cost Centre", "type": "select", "options": ["admin", "sales", "plant"],
      "companySettings": { "acme-uae": { "required": true, "options": ["admin", "sales"] } } }
  ]
}

On an app's table, whose columns are the app's, a tenant puts them in the field's columnSettings.<column> instead, as for any other column customisation. A column's company setting may change label, help, required, readOnly, visibleWhen, requiredWhen, readOnlyWhen and options (a subset of a select column's). A column has no default.

In a company that doesn't use a column:

  • the grid leaves the column out;
  • the import template leaves out its table.column column;
  • describe_records_model doesn't list it;
  • it is never required;
  • a line that fills it is refused with 400 Column "lines.hsn" is not used in company "acme-uae".

Stored cells are kept, and a row that echoes its stored cell is not refused. A column another app contributes can be limited to some companies, but it can't be required in one, because the table's own app writes lines without it.

The record's company decides

A field is always judged in the record's own company: the stored company of an existing record, or the company a new record is created in. The company someone is working in does not decide. A record of Acme UK opened while working in All Companies shows Acme UK's fields.

Conditions get a variable for it: { "var": "recordCompany" } (RECORD_COMPANY() in a formula). It is the record's own company. scopeEntity (CURRENT_COMPANY()) is still the company being worked in. Prefer companies and companySettings to a condition on the company: they also refuse the value on save, offer the right choices and reach the import template and Droot AI.

Only company-scoped models

Only a company-scoped model's fields (scoped: true) take either property. A shared master (a party, an item) is the same record in every company. Its company-specific values live on its company row model (entityExtension.model, such as Party in Company or Item in Company), and that model's fields can differ by company. The title field is used in every company, and a form-only field has no companies.

What each part of the platform does

Area Behaviour
Forms The manifest's field carries perCompany for each company the reader works in: { "unused": true } or the properties that differ. The form applies the record company's entry. A field that none of the selected companies use is left out.
Lists and filters A field that none of the selected companies use is not a column or a filter. With several companies selected, a cell from a company that doesn't use the field is blank.
Saves (every writer) The company-fields command check refuses an unused field and an option the company doesn't offer. The required check, defaults and read-only checks use the field as it is in the record's company. Seed data and the ledger are not checked.
Import The template and its default mapping are the current company's. Each row is saved as any other write.
API v1 and OpenAPI The schema stays group-wide, so integrations don't break. A company-specific field says where it is used (x-droot-companies) and is not listed as required.
Droot AI and MCP describe_records_model describes the fields as they are in the current company, with usedIn for a restricted field. The configuration guide knows both properties.
Automations, flows, approvals, save and change rules, scripts Unchanged. They read the record's values, so an unused field reads blank. A rule that requires or sets such a field in a company that doesn't use it fails there, like any other write. Setup lists where the field is used when you restrict it.
Reports, dashboards, KPIs Unchanged: one field for the group, blank where it isn't used, so consolidation stays correct.
Field removal and type change companies and companySettings move with the field. Conditions in companySettings count as uses of the fields they name.

Limits

  • At most 200 companies per field in companies, and 200 in companySettings.
  • Uniqueness stays group-wide: a unique field is unique per company (as before), but not unique only in some companies.
  • A field's (or column's) type, key, storage, lookup target, calculation, encryption and personal-data flag are the same everywhere.