Menu
Feedback
Start here
Tutorials


Tutorials
Master Data basics
Data entity
Data entity
6 min read

A data entity is a representation of a set of information about a given concept. Each entity includes fields with information that makes up the entity.

For example, imagine a system that controls a library. This system controls books that customers can borrow. Thus, we can notice that these three concepts (book, customer, borrowing) are entities that contain information about each one.

{"base64":"  ","img":{"width":1758,"height":956,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":58320,"url":"https://raw.githubusercontent.com/vtexdocs/help-center-content/refs/heads/main/docs/en/tutorials/master-data/master-data-basics/data-entity_1.png"}}

With these concepts in mind, you can set up several data control scenarios in Master Data. By default, the following data entities are considered: customer, address, stores, etc. You can create as many data entities as you want to develop a customized environment tailored to your store's needs.

This article outlines the Master Data v1 operation. You should evaluate which Master Data version meets your needs or is in use in your operation. Learn more:

Data types

The data entity consists of fields that have a type. This type identifies the information characteristics stored in the field and enables validations, filters, and calculations based on the selected value.

When creating a field, the following types are displayed:

Field typeDescription
Auto IncrementStores integers and is automatically incremented, which means that for each new record, this field receives the value of the previous record + 1.
BooleanStores true or false information, which means it will always be completed as true or false.
CEPStores a CEP (postal code in Brazil).
CPF / CNPJStores the CPF and CNPJ information (taxpayer registration number and company registration number in Brazil, respectively).
CurrencyStores information in currency format.
DateStores date information.
Date and TimeStores date and time.
DecimalStores numbers with the fractional part always set to 2. This field will always store 2 digits as decimal places of the value entered.
EmailStores an email.
FileStores a file. The maximum size accepted must be set up in the field’s options via the gear icon button.
IntegerStores integers, i.e., numbers without the fractional part. It stores whole numbers between -2147483648 and 2147483647.
LongSimilar to Integer but can store more numbers. Stores from -2⁶³ to 2⁶³-1.
PercentStores information in a percentage format.
PhoneStores information in a phone number format.
RelationshipCreates a relationship with another entity. The term relationship refers to displaying an entity’s information in another entity. For example, in the library example, the Customer may also appear in the Borrowing record.

To do so, you just have to establish a relationship between Borrowing and Customer by using the Name field under Borrowing and selecting the Relationship type in the settings. The Customer field to be displayed must also be selected for the Name field to be selected.
Score2Field consisting of key, value, and expiration date. For example: This can be used to control purchases made by each customer, storing the amount and quantity of purchases. This field needs to be completed through the Update scores or the Update score by field endpoint from Master Data API v1.
TextStores numbers, letters, and special characters, without a character limit.
TimeStores time information.
URLStores a URL.
User LoginAutomatically selects the user logged in. This is used to record the email of the user who performs an action on an entity record.
Varchar 10Stores numbers, letters, and special characters, limited to 10 characters.
Varchar 100Stores numbers, letters, and special characters, limited to 100 characters.
Varchar 50Stores numbers, letters, and special characters, limited to 50 characters.
Varchar 750Stores numbers, letters, and special characters, limited to 750 characters.

Creating data entities

Follow the steps below to configure a new data entity.

  1. In the VTEX Admin, go to Store Settings > Storefront > Master Data.

  2. In Master Data, click Applications > Advanced Settings > Data structure.

  3. Click the Data Entities tab.

  4. Click the Add button.

  5. Complete the Acronym field with 2 letters that identify the data entity. These letters will be the initials of the field that identifies the record. For example: use the acronym SP for identifier SP-0001.

  6. Complete the Name of the data entity you want to create.

  7. Select the type of primary key, which can be:

    • GUID: A unique sequence of numbers and characters that identifies a record.
    • Primary key must be given using the 'ID' property: This key does not automatically create an identifier field, which must be created manually and named ID.
  8. If you need to consult records without a filter and without authentication, check the option Allow all document query without filter. Note: This setting is critical because it allows all the records in the database to be listed via the API.

  9. Complete the Fields tab with the fields you want to include in the new data entity, indicated as follows.

  10. Complete the Name column with the field's identification value. Do not insert spaces or special characters. Example: CustomerName.

  11. Complete the Display Name column with the name that will be displayed on the form. Example: Customer name.

  12. Select the field type based on the options described in the Data types section.

  13. Click the gear icon to open the field configuration options.

  14. Complete the General settings:

    • Is nullable?: Check this option to create or edit a record with a blank (void) field. If this option is unchecked, you cannot create a record without a value in this field.
    • Make readable without credentials: Check this option to allow the field data to be read without authentication, using the Master Data API.
    • Allow editing without credentials: Check this option to allow data to be entered into the field without the need for authentication, using the Master Data API.
    • Allow filtering without credentials: Check this option to filter field data without the need for authentication, using the Master Data API.
  15. Complete the Search and filter settings:

    • Is searchable?: If this field is used for searching in the form and via API.
    • Is filterable?: If this field is used to filter the form and via API.
  16. Add a field description.

  17. To add more fields, click the New Field button and repeat steps 10 to 16.

  18. At the end of the field definition, click the Save button to complete or Save and New to create a new data entity.

    You will be redirected back to the Data Entity tab.

  19. In the row of the newly created entity, click the diskette button to publish the created data entity.

  20. Click OK.

  21. Click the Applications tab to return to the Master Data homepage.

  22. Click the Reload Applications button.

Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Master Data
« Previous
Exporting the newsletter database using Master Data
Next »
Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
On this page
Still got questions?
Ask the community
Find solutions and share ideas in the VTEX community.
Join our community
Request support from VTEX
For personalized assistance, contact our experts.
Open a support ticket
GithubDeveloper portalCommunityFeedback