创建自定义选择列表Create custom picklists

现在,除了现成的选择列表外,还可以创建你自己的选择列表。It's now possible to create your own picklists, in addition to the ones that are available out-of-the-box. 选择列表的概念非常简单,基本上就是包含名称和说明的项的已命名列表。Picklists, which are basically a named list of items that include a name and descriptions, are a simple concept. 呈现选择列表字段时,还会显示一个下拉列表菜单,其中包含项的显示名称。When the picklist fields are rendered, a drop-down menu that contains the display names of the items will appear.

选择列表是使用菜单项进行添加,即“实体”菜单下的“Common Data Service”选项卡上的“选择列表”。Picklists are added by using the menu item, Picklists on the Common Data Service tab, under the Entities menu. 单击此菜单可查看当前在环境中定义的所有选择列表。Click the menu to view all of the picklists that are currently defined in your environment. 系统已为你定义了多个常用选择列表,可通过其类型“标准”轻松识别。Several commonly used picklists are already defined for you and can easily be identified by their type, Standard. 你自行创建的选择列表的类型是“自定义”。The ones that you create for yourself are the type Custom.

  1. 若要新建选择列表,请单击页面顶部的“新建选择列表”。To create a new picklist, at the top of the page, click New Picklist. 在随即打开的页面上,输入名称、显示名称和说明来定义选择列表。On the page that opens, define your picklist by entering the name, display name, and a description.

    重要

    选择列表一旦创建,便无法再更改它的名称。The picklist name can't be changed after you create the picklist. 选择列表的名称必须遵循几项要求。There are a few requirements for the picklist name. 名称必须简单,不得包含任何特殊字符。The name must be simple and can't contain any special characters. 此外,每个选择列表都必须有一个独一无二的名称。Also, you can only have one picklist with a particular name. 如果尝试创建另一个同名的选择列表,将会看到错误消息。If you try to create another picklist with the same name, you will receive an error. 这些限制并不适用于显示名称These restrictions don't apply to the Display name.

    在本主题中,我们将创建一个可用于选择交通方式的选择列表。In this topic, we will create a picklist that can be used to choose a mode of transportation.

  2. 将选择列表命名为“Transportation”,然后向必填字段添加信息。Name the picklist Transportation and add the information to the required fields.
  3. 单击“下一步”,然后在下一页上提供选择列表的不同元素(对于此示例,提供交通服务提供商)。Click Next, and on the next page provide the different elements of the picklist, for this example, the transportation providers. 当页面打开时,你会发现有一项已创建。When the page opens, you will see that a single item is already created. 更新行项,使其包含要创建的选择列表的相应信息。Update the line item with information appropriate to the picklist that you are creating. 编辑是在各行中完成。Editing is done in the line. 各个选择列表项没有单独的页面。There is not a separate page for each picklist item. 单击“新建项”字段,添加第一项。Click in the NewItem field to add the first item. 每当需要添加新的选择列表元素时,单击屏幕右上角的“添加项”来添加新的一行。Any time that you need a new picklist element, click Add item at the top right of the screen to add a new row.

可以单击各个行项最右侧的垃圾桶图标来删除相应项。You can delete an item by clicking the garbage can icon on the far right of each item line. 添加完所需的全部项后,单击“创建”创建选择列表,并将其提交到服务器中。When all of the required items have been added, click Create to create the list and submit it to the server. 你会发现,此选择列表已添加到现有选择列表的列表中。You will see the picklist added to the list of existing picklists.

现在可以添加字段类型“选择列表”,然后使用字段的“属性”窗格中的“显示名称”来定义实体字段。You can now use the picklist to define fields on your entities by adding a field type Picklist, and then using the Display name in the Properties pane for the field.