查询Picklist的描述值
我正在尝试从 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;
}
}
谢谢!
I am trying to get the value from the Description field of a picklist in CRM, this is what I am using to get the Label value, how would I change it to get the Description Value?
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;
}
}
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过访问
Description
属性来查找选项集中特定选项的说明。像这样:
string description = option.Description.UserLocalizedLabel.Label.ToString();
这里是
PicklistAttributeMetadata
公开的成员列表。You can find the description for a specific option in a optionset by accessing the
Description
property.Like this:
string description = option.Description.UserLocalizedLabel.Label.ToString();
Here is a list of members exposed by the
PicklistAttributeMetadata
.