smart_field. Nobody types its value: TWICE Commerce reads it from data the record already carries, or fetches it from your own API through a connector.
Reach for one where the value already exists somewhere and copying it by hand goes wrong. A binding setting from a fitting service, a membership level from your CRM, a boot sole length carried over to the skis sold with the boots.
How it works
Where the value comes from
Every smart field is one of two kinds, and the editor’s first step asks which.Output type
Output type is the format the value is stored, filtered, sorted and grouped as. Pick one of Text, Number, Yes / No or Date. A smart field behaves everywhere as a plain attribute of its output type, so a number sorts as a number and a date filters as a date.Placeholders
A request is text with placeholders in double curly braces. One value has one address:
Build them with Insert data rather than typing them. The picker offers only what the field can reach, and names a placeholder it cannot resolve before you save.
A Read from data field takes exactly one placeholder, which is its whole definition. A Call an API field may use as many as the request needs.
Which data a template can read
What a template may address depends on the record the value is computed on, not on where the attribute was defined. Order data is only there when the compute runs from an order.
A field whose request names order, line item or customer data shows its compute action disabled on the SKU and stock item pages, and says which data is missing there.
When a value is computed
Compute automatically is on by default. With it on, an order fetches the value the first time every input it uses is filled in, and again whenever one of those inputs or the field’s own setup changes. Turn it off and the value waits for someone to press Compute value. An order refreshes its values while its status is Open or In progress. A Completed order keeps what it was handed over with, and a draft has nothing to prepare yet. Each compute stores what its inputs were worth. A later read compares them again, which is how a value that no longer matches the order says so instead of looking current. A stale value names the input that moved, with its old and new value. A value someone typed, a value inherited from a SKU or stock item, a first fetch that failed, and a value with an input still empty are left alone rather than fetched on their own.A value on an order unit
A fulfillment field on a unit can hold values from several places at once. The order shows the first one that has a value:- What staff typed on the order
- The computed result
- The value read from order data
- The stock item’s value
- The SKU’s value
When a compute fails
A failed compute keeps the previous value and records the error on the field. Press the warning to read the whole message, which names the last attempt and the most common causes: a wrong endpoint path, a missing or expired key, or an external service nothing can reach. Deleting a connector leaves every field using it in place. Each next compute fails with that message and the stored value stays put until the field is given a connector again.Usage
Create a smart field
Connect the API first under Settings → Integrations & API, then define the field under Settings → Attributes & Tags.- Open the resource the field belongs to and add an attribute
- Choose Smart field as the type
- Pick Read from data or Call an API
- For Call an API, name the connector, the method and endpoint path, the request, and the response path
- For Read from data, pick the one value the field reads
- Set the output type, and decide whether it computes automatically
Where a smart field can live
A smart field cannot be a global attribute. A global one would put an outbound call on every record in the account, so you attach it to the records that need it.
Related articles
Attributes
Formats, input masks, keys, inheritance, and API access.
Integrations & API settings
Connectors, API keys, and webhooks.
Attributes & Tags settings
Where attributes, fulfillment fields, groups and tags are managed.
Formulas
The other computed format, worked out from fields on the same record.