Unable to cast object of type ‘Microsoft.Xrm.Sdk.OptionSetValue’ to type ‘System.String’
Unable to cast object of type ‘Microsoft.Xrm.Sdk.OptionSetValue’ to type ‘System.String’
if you facing OptionSetValue Cast error in your Plugin use this code to resolve the problem
OptionSetValue learnerAggrementoptionSetValue = guids.GetAttributeValue<OptionSetValue>(“vwi_learneragreementtype”);
if (learnerAggrementoptionSetValue != null)
{
int selectedOptionValue = learnerAggrementoptionSetValue.Value;
}