private string GetCRMOptionSetLabel(IOrganizationService service, string entityname, string optionsetname, int value)
{
RetrieveAttributeRequest reqOptionSet = new RetrieveAttributeRequest();
reqOptionSet.EntityLogicalName = entityname;
reqOptionSet.LogicalName = optionsetname;
RetrieveAttributeResponse resp = (RetrieveAttributeResponse)service.Execute(reqOptionSet);
PicklistAttributeMetadata opdata = (PicklistAttributeMetadata)resp.AttributeMetadata;
var option = opdata.OptionSet.Options.FirstOrDefault(o => o.Value == value);
return option.Label.LocalizedLabels.FirstOrDefault().Label;
}
- I hope this helps!
No comments:
Post a Comment