Hello,
iam using below code to get optionset metadata details but now i want to get same details using REST API in c# can you please suggest code how to retrieve details ?
RetrieveAttributeRequest retrieveAttributeRequest = new
RetrieveAttributeRequest
{
EntityLogicalName = entityName,
LogicalName = attributeName,
RetrieveAsIfPublished = true
};
// Execute the request.
RetrieveAttributeResponse retrieveAttributeResponse = (RetrieveAttributeResponse)service.Execute(retrieveAttributeRequest);
// Access the retrieved attribute.
Microsoft.Xrm.Sdk.Metadata.PicklistAttributeMetadata retrievedPicklistAttributeMetadata = (Microsoft.Xrm.Sdk.Metadata.PicklistAttributeMetadata)
retrieveAttributeResponse.AttributeMetadata;// Get the current options list for the retrieved attribute.
OptionMetadata[] optionList = retrievedPicklistAttributeMetadata.OptionSet.Options.ToArray();
int selectedOptionValue = 0;
foreach (OptionMetadata oMD in optionList)
{
if (oMD.Label.LocalizedLabels[0].Label.ToString().ToLower() == selectedLabel.ToLower())
{
selectedOptionValue = oMD.Value.Value;
break;
}
}
return selectedOptionValue;