string st = GetPickListItemValue("account", "new_frequency", "Frequency");
public static string GetPickListItemValue(string entityName, string pickListName, string itemLabel)
{
string itemValue = string.Empty;
try
{
MetadataService.MetadataService service =new CLMApplication.MetadataService.MetadataService();
service = GetMetaService();
RetrieveAttributeRequest attribReq = new RetrieveAttributeRequest();
attribReq.EntityLogicalName = entityName;
attribReq.LogicalName = pickListName;
// Get the attribute metadata for the pickListName attribute.
RetrieveAttributeResponse amRes = (RetrieveAttributeResponse)service.Execute(attribReq);
AttributeMetadata am = amRes.AttributeMetadata;
PicklistAttributeMetadata listData = (PicklistAttributeMetadata)am;
foreach (Option option in listData.Options)
{
foreach (CLMApplication.MetadataService.LocLabel label in option.Label.LocLabels)
{
// Show US English value:label pairs
if (label.LanguageCode.Value == 1033)
//if (label.Label.Equals(itemLabel))
//{
//itemValue = option.Value.Value;
itemValue = itemValue + option.Value.Value.ToString() + ";";
itemValue = itemValue + option.Label.LocLabels[0].Label.ToString() + ",";
//}
}
}
}
catch (Exception ex)
{
}
return itemValue;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment