【问题标题】:Query the Description Value of a Picklist查询选项列表的描述值
【发布时间】:2011-10-15 19:03:27
【问题描述】:

我正在尝试从 CRM 中选择列表的描述字段中获取值,这就是我用来获取标签值的方法,我将如何更改它以获取描述值?

RetrieveAttributeRequest request = new RetrieveAttributeRequest();
request.EntityLogicalName = "opportunity";
request.LogicalName = "country";

RetrieveAttributeResponse response = (RetrieveAttributeResponse)orgService.Execute(request);
PicklistAttributeMetadata picklist = (PicklistAttributeMetadata)response.AttributeMetadata;

foreach (OptionMetadata option in picklist.OptionSet.Options)
    {
        string picklistlabel =  option.Label.UserLocalizedLabel.Label.ToString();

        if (p.Column_16.ToString().ToUpper() == picklistlabel.ToString().ToUpper())
            {
                 countryid= option.Value;
            }
    }

谢谢!

【问题讨论】:

    标签: dynamics-crm dynamics-crm-4 dynamics-crm-2011


    【解决方案1】:

    您可以通过访问Description 属性在选项集中找到特定选项的描述。

    像这样:

    string description = option.Description.UserLocalizedLabel.Label.ToString();

    HerePicklistAttributeMetadata 暴露的成员列表。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多