Skip to main content

Custom attributes

You can start with a walkthrough instead of reading this document first. A walkthrough is the practical extension of the concepts in this document. It puts them into practice through one example with concrete values. Each part of the walkthrough explains the concepts that its steps apply and links to the sections that cover them.

Custom attributes: details that you add to records

A custom attribute is a field that an organization adds to customers, contracts, or products to record details that their fixed fields do not hold.
Conceptual diagram of a custom attribute. A custom attribute has a name, a custom attribute key, a custom attribute type, a list of options, a default value, and whether it is required. A customer attribute or a contract attribute can also copy to new records. Its custom attribute type is text, whole number, decimal number, checkbox, dropdown, multi-select, or array. A product is a representative example of a record that has values of custom attributes. Other modules also use custom attributes.Conceptual diagram of a custom attribute. A custom attribute has a name, a custom attribute key, a custom attribute type, a list of options, a default value, and whether it is required. A customer attribute or a contract attribute can also copy to new records. Its custom attribute type is text, whole number, decimal number, checkbox, dropdown, multi-select, or array. A product is a representative example of a record that has values of custom attributes. Other modules also use custom attributes.

This conceptual diagram shows what a custom attribute has, with a product as an example of a record that uses custom attributes.

Zenskar gives each customer, contract, and product a fixed set of fields. When a business needs to record more, such as the sales region of each customer, it adds a custom attribute. An organization sets up a custom attribute once, and each customer, contract, or product then has its own value for it. The name and the custom attribute key of a custom attribute are unique in the organization, across all kinds of records.
A custom attribute cannot be deleted.
A custom attribute belongs to one kind of record: The kind of record that a custom attribute belongs to cannot change after the custom attribute is created.

Scope: which records a custom attribute applies to

A custom attribute has one of two scopes: A custom attribute scoped to one business entity applies only to the records of that business entity. Changing the scope of a custom attribute does not change the values saved on records.

Required values: what a record must have

A required custom attribute needs a value on every record, such as a sales region on every customer. It works as follows:
  • Saving a record without a value writes the default value.
  • Without a default value, saving a record without a value fails.
  • You cannot remove its value from a record of the kind that it belongs to.
Making a custom attribute required, or optional again, does not change the values already saved on records. A record that has no value follows these rules at its next save.

Custom attribute keys: how a custom attribute is identified

A custom attribute key is the identifier of a custom attribute. A custom attribute has a name and one custom attribute key: A custom attribute key cannot change after the custom attribute is created. The name can change at any time, without affecting the custom attribute key or anything that uses it.

Custom attribute types: what a value can hold

A custom attribute type is the kind of value that a custom attribute holds. A custom attribute type cannot change after the custom attribute is created. Each custom attribute has one of the following custom attribute types:

Options: what a list value can be

The list types, dropdown and multi-select, use a list of options:
  • A value must come from the list of options.
  • A record keeps an option that was removed from the list.

Default values: what a new record starts with

A default value must fit the custom attribute type, such as EMEA for a sales region. It works as follows:
  • A new record without a value gets the default value of the custom attribute.
  • Adding or changing a default value does not change existing records.

Copied values: how new records receive values

A copied value is the value of a custom attribute that a new record receives from the customer or the contract that it belongs to.
Copied values keep records auditable.
For example, Acme Corp is a customer with the customer attribute Sales region, which copies to new contracts and invoices of Acme Corp. The value of Sales region on Acme Corp starts as APAC.

Behavior: how copied values work

  • A new record receives a copied value once, when the record is created. Contract_1 receives APAC when your billing team creates it.
  • A copied value does not change when its source changes. When Sales region on Acme Corp changes to Americas, Contract_1 keeps APAC. Contract_2, created after that change, receives Americas.
  • Draft and upcoming invoices are an exception. When an active contract changes, Zenskar rebuilds its draft and upcoming invoices. Each rebuilt invoice receives the copied value again. When Sales region on Contract_1 changes to EMEA, each draft invoice of Contract_1 receives EMEA. Other invoices keep their values.
  • A change to a copied value does not change its source. When Sales region on Contract_1 changes to EMEA, Acme Corp keeps Americas.
  • A new record receives the copied value from the nearest record that has a value. The invoice receives EMEA from Contract_1. If Contract_1 had no value, the invoice would receive Americas from Acme Corp.
  • A value that uses an option removed from the list still copies. If Americas is removed from the list, a new contract of Acme Corp still receives Americas.
  • Turning copying on or off affects only new records. If copying is turned off, Contract_1 and Contract_2 keep their values, but a new contract of Acme Corp receives no value.
  • A record that can receive a copied value does not need a value, even when the custom attribute is required. If Sales region is required, Acme Corp needs a value, but Contract_1 does not.
  • A record that can receive a copied value does not get the default value. If Sales region has the default value EMEA and Acme Corp has no value, Contract_1 has no value.
See Restore a copied value on a new contract. See End-to-end walkthrough: How custom attributes work.