Attribute Data Types, Validations, and Transformations

Whenever you think about attributes (assuming that you ever do think about attributes), you no doubt think in terms of datatypes: an attribute designed to hold true/false values has the boolean datatype; an attribute designed to store a user’s birthday has a date datatype; and so on. Datatypes are obviously important, and in this documentation we’ll cover the datatypes supported for use with entity type schemas:

In addition to the datatypes, however, we’ll also cover two other important (but sometimes overlooked) properties of schema attributes: validations and transformations. Validations enable you to specify special properties for an attribute. For example, if you marked an attribute as required that means that the attribute must be given a non-null value before a change can be made to a user profile:

Meanwhile, transformations make formatting changes to data at the time it’s written to a user’s user profile. For example, the Convert to Uppercase transformation changes all the characters in a string to their uppercase equivalents. Suppose you save this value to an attribute where the Convert to Uppercase transformation has been applied:

When the value is actually written to the user profile, however, it will be written like this:

Keep in mind that attribute validations and transformation take place only after a form has been submitted and when data is actually being written to the user profile. This differs from field-level validations, which take place before a form is submitted.