创建自定义实体Create a custom entity

可以创建自定义实体来存储特定于组织的数据。You can create a custom entity to store data that is specific to your organization. 然后可通过开发引用该实体的应用来显示该数据。You can then show that data by developing an app that refers to the entity.

创建实体的方法有两种:There are two ways to create an entity:

  • 从头开始创建实体。Create the entity from scratch. 默认情况下,实体仅包含四个系统字段和一个记录标题字段By default, the entity contains only four system fields and a record title field.
  • 复制另一实体的字段和设置,但不复制数据,从而在此实体的基础上创建新实体。Create an entity that is based on another entity, by copying the fields and settings of that entity, but not its data.

在这两种情况下,Microsoft PowerApps 都会自动存储并帮助保护数据。In both cases, Microsoft PowerApps automatically stores and helps secure the data. 创建实体后,可以创建或修改实体的一个或多个字段,以及 构建实体之间的关系After you create an entity, you can create or modify one or more of its fields, and build relationships between entities.

注意:创建实体之前,请参阅标准实体列表Note: Before you create an entity, see the list of standard entities. 这些实体涵盖典型的方案,如客户和联系人。These entities cover typical scenarios, such as accounts and contacts. 如果有符合你要求的现成实体或仅需稍加更改的实体,可使用该实体以节省时间。If one of these entities will meet your requirements out of the box or after only minor changes, you can save yourself some time by starting with that entity.

创建实体Create an entity

    1. powerapps.com 上,展开“Common Data Service”部分,单击或点击左侧导航窗格中的“实体”。On powerapps.com, expand the Common Data Service section and click or tap Entities in the left navigation pane.
  1. 如果尚未创建数据库,需要创建一个数据库。If you haven't created a database, you need to create one. 有关详细信息,请参阅创建 Common Data Service 数据库For more information, see Create a Common Data Service database.
  2. 在右上角附近,单击或点击“新建实体”。Near the upper-right corner, click or tap New entity.
  3. 在“实体名称”字段中,输入实体的名称。In the Entity name field, enter a name for the entity. 确保实体名称清楚且有意义,因为创建该实体后无法再进行更改。Make sure that the name is clear and meaningful, because you can't change it after you create the entity. 开发应用时,将通过此名称在公式中引用该实体。When you develop an app, you will reference the entity by this name in a formula.
  4. 为实体指定一个显示名称和(可选)说明,然后单击或点击“下一步”。Specify a display name and, optionally, a description for the entity, and then click or tap Next.
  5. 可选:将“标题”字段中的值更改为对数据更有意义的值。Optional: Change the value in the Title field to something that is more meaningful for your data.
  6. 单击或点击“创建”,创建实体。Click or tap Create to create the entity.

实体将出现在数据库的实体列表中。Your entity appears in the list of entities in your database. 若要在列表顶部显示实体,请单击或点击“类型”列标题。To show your entity at the top of the list, click or tap the Type column header. 实体将按类型排序,且所有自定义实体将显示在所有标准实体上方。The entities will be sorted by type, and all custom entities will appear above all standard entities.

系统字段和记录标题字段System fields and the record title field

所有实体均包含五个系统字段。All entities have five system fields. 这些字段为只读。These fields are read-only. 因此,无法更改或删除这些字段,且无法为它们赋值。Therefore, you can't change or delete these fields, and you don't assign values to them.

显示名称Display name 系统字段名称System field name 数据类型Data type 说明Description
IDId 系统字段名称System field name 大整数Big Integer 记录的唯一标识符。The unique identifier for the record.
创建者Created By CreatedByUserCreatedByUser 文本Text 创建记录的用户。The user who created a record.
记录创建日期Created Record Date CreatedOnDateTimeCreatedOnDateTime 日期/时间DateTime 创建记录的日期和时间。The date and time when a record was created.
上次修改者Last modified By LastModifiedByUserLastModifiedByUser 文本Text 最近修改记录的用户。The user who most recently modified the record.
记录修改日期Modified Record Date LastModifiedDateTimeLastModifiedDateTime 日期/时间DateTime 最近修改记录的日期和时间。The date and time when a record was most recently modified.

如果从头开始创建实体,它还包含名为“标题”的自定义字段。If you create an entity from scratch, it also contains a custom field that is named Title. 将此字段设置为记录的“标题”字段。This field is set as the record's Title field. “标题”字段值是记录的易用标识符(无论何时在应用中使用该记录都是如此)。The Title field value is the user-friendly identifier of a record whenever you use that record in an app. 可以将任意字段更改为“标题”字段,但每个实体都必须有一个“标题”字段。You can change which field is the Title field, but every entity must have a Title field.

后续步骤Next steps

隐私声明Privacy notice

通过 Microsoft PowerApps 通用数据模型,我们收集自定义实体和字段名称并将其存储在诊断系统中。With the Microsoft PowerApps common data model we collect and store custom entity and field names in our diagnostic systems. 我们利用这一知识来改进我们客户的通用数据模型。We use this knowledge to improve the common data model for our customers. 创建者创建的实体和字段名称帮助我们了解 Microsoft PowerApps 社区中的常见方案,并确定服务标准实体范围中的缺口,如与组织相关的架构。The entity and field names that Creators create help us understand scenarios that are common across the Microsoft PowerApps community and ascertain gaps in the service’s standard entity coverage, such as schemas related to organizations. Microsoft 无法访问或使用数据库表中与这些实体相关联的数据,此类数据也无法在预配了数据库的区域之外进行复制。The data in the database tables associated with these entities is not accessed or used by Microsoft or replicated outside of the region in which the database is provisioned. 不过,请注意,自定义实体和字段名称可能可以进行跨区域复制,并根据我们的数据保留策略进行删除。Note, however, the custom entity and field names may be replicated across regions and are deleted in accordance with our data retention policies. Microsoft 致力于保护你的隐私安全,我们的信任中心对此进行了详述。Microsoft is committed to your privacy as described further in our Trust Center.