管理自定义字段Manage custom fields

可以在任意实体中创建和更新一个或多个自定义字段。You can create and update one or more custom fields in any entity. 创建自定义字段时,可以指定一组属性,例如字段名称、其显示名称及其将包含的数据类型。When you create a custom field, you specify a set of properties, such as the field's name, its display name, and the type of data that it will contain. 有关详细信息,请参阅 Enity field data types(实体字段数据类型)和 Entity field properties(实体字段属性)。For more information, see Enity field data types and Entity field properties.

备注

每个实体都有系统字段,如指示上次记录更新时间和更新人员的字段。Every entity has system fields, such as fields that indicate when a record was last updated, and who updated it. 此外,标准实体还包含标准(默认)字段。In addition, standard entities have standard (default) fields. 无法修改或删除系统字段或标准字段。You can't modify or delete system fields or standard fields. 如果创建自定义字段,则它应在这些内置字段上提供功能。If you create a custom field, it should provide functionality on top of these built-in fields.

创建字段Create a field

  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. 将显示实体列表。A list of entities appears. 若要在列表顶部显示自定义实体,请单击或点击“类型”列标题。To show custom entities at the top of the list, click or tap the Type column header. 此外,在搜索栏中键入一个或多个字符可筛选列表。You can also filter the list by typing one or more characters in the search bar.

  2. 单击或点击实体,然后单击或点击屏幕顶部附近的“添加字段”。Click or tap an entity, and then click or tap Add field near the top of the screen.

  3. 在“显示名称”下,指定可为用户识别字段的文本字符串。Under Display name, specify the string of text that will identify the field to users. 有关详细信息,请参见创建应用For more information, see Create an app.

  4. 在“名称”下,指定将用于引用字段的文本字符串,例如生成应用时的公式。Under Name, specify the string of text that you will use to refer to the field in, for example, a formula when you build an app.

    重要

    请指定唯一、明确的有意义名称,因为创建字段后便无法再更改名称。Specify a name that's unique, clear, and meaningful, because you can't change the name after you create the field.

  5. 在“类型”下,指定该字段将包含的数据类型,例如文本数字Under Type, specify the type of data that the field will contain, such as Text or Number.

    重要

    请慎重指定此属性,因为在字段包含数据后便无法再更改它。Specify this property carefully, because you might not be able to change it after the field contains data. 有关可以指定的数据类型的信息,请参阅 了解实体For information about the types of data that you can specify, see Understand entities.

  6. 如果系统提示,则指定你所指定的数据类型的其他信息。If you're prompted, specify additional information for the data type that you specified.

  7. 如果每条记录必须包含此字段中的唯一值,请选中“唯一”复选框。Under Unique, select the check box if every record must have a unique value in this field.

  8. 如果每条记录必须包含此字段中的一个值,请选中“必需”复选框。Under Required, select the check box if every record must have a value in this field.

    重要

    无法要求标准实体中的自定义字段必须包含数据。You can't require that a custom field in a standard entity contain data. 此限制可以保护依赖于该实体的任何应用。This restriction prevents you from breaking any apps that rely on that entity.

  9. 单击或点击“保存”,提交所做更改。Click or tap Save to submit your changes.

    重要

    如果在浏览器中打开其他页面或退出浏览器前未保存更改,所做更改将会丢失。Your changes will be lost if you don't save them before you open another page in the browser or exit the browser.

该操作成功完成后,你将收到通知。You're notified when the operation is completed successfully. 如果操作失败,错误消息会指示出现的问题以及修复方法。If the operation is unsuccessful, an error message indicates the issues that occurred and how you can fix them.

更新或删除字段Update or delete a field

  1. powerapps.com 上,依次单击或点击“管理”、“实体”,然后单击或点击实体。On powerapps.com, click or tap Manage, click or tap Entities, and then click or tap an entity.
  2. 在所选实体的字段列表中,单击或点击一个字段,然后按照以下步骤之一操作:In the list of fields for the entity that you selected, click or tap a field, and then follow one of these steps:

    • 更改字段的一个或多个属性。Change one or more properties of the field. 请记住最佳做法和限制Keep in mind the best practices and restrictions.

      要选择下一个属性,请按 Tab 键。要撤消对某个字段的所有更改,请单击或点击该字段的省略号 (...),然后单击或点击“撤消”。To select the next property, press Tab. To undo all changes to a field, click or tap the ellipsis (...) for the field, and then click or tap Undo.

    • 单击或点击字段右边缘附近的省略号 (...),然后单击或点击“删除”可删除该字段。Delete the field by clicking or tapping the ellipsis (...) near the right edge of the field, and then clicking or tapping Delete.
  3. 单击或点击“保存”,提交所做更改。Click or tap Save to submit your changes.

    重要

    如果在浏览器中打开其他页面或退出浏览器前未保存更改,所做更改将会丢失。Your changes will be lost if you don't save them before you open another page in the browser or exit the browser.

该操作成功完成后,你将收到通知。You're notified when the operation is completed successfully. 如果操作失败,错误消息会指示出现的问题以及修复方法。If the operation is unsuccessful, an error message indicates the issues that occurred and how you can fix them.

最佳做法和限制Best practices and restrictions

创建和修改字段时,请记住以下事项:As you create and modify fields, keep these points in mind:

  • 无法修改或删除系统字段或其值。You can't modify or delete system fields or their values.
  • 在标准实体中,不能修改或删除标准(默认)字段、添加需要数据的字段或做出可能破坏依赖于该实体的应用的任何其他更改。In a standard entity, you can't modify or delete a standard (default) field, add a field that requires data, or make any other change that might break an app that relies on that entity.
  • 在自定义实体中,应确保所做的更改不会破坏依赖于该实体的任何应用。In a custom entity, you should make sure that the changes that you make won't break any app that relies on that entity.
  • 必须为每个自定义字段指定一个名称,该名称在实体中是唯一的,并且在创建该名称后不能重命名字段。You must give each custom field a name that's unique within the entity, and you can't rename a field after you create it.
  • 如果字段尚未包含数据,可以更改字段的数据类型。You can change the data type of any field, provided that the field doesn't yet contain data. 在字段已经包含数据的情况下,如果所有现有数据均满足新的数据类型要求,则可以更改数据类型。If the field already contains data, you can change the data type, provided that all the existing data meets the requirements of the new data type. 例如,可以将字段的数据类型从数字更改为字符串,但如果字段包含非数值数据,则无法将数据类型从字符串更改为数字For example, you can change the data type of a field from Number to String, but you can't change the data type from String to Number if the field contains non-numerical data.
  • 如果通过以下一种或多种方式修改实体中的字段,则可能会破坏使用该实体的应用:You might break an app that uses an entity if you modify a field in that entity in one or more of these ways:
    • 更改字段的数据类型。You change the field's data type.
    • 需要值,但一条或多条记录不包含该字段中的值。You require values, but one or more records don't contain a value in that field.
    • 需要唯一值,但两条或更多记录包含该字段中的同一个值。You require unique values, but two or more records contain the same value in that 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.