Hi Experts,
I am writing a plugin. I am trying to assign the value retrieved after running the query to variable of type int. But I am getting an error message : System.InvalidCastException: Unable to cast object of type 'Microsoft.Xrm.Sdk.OptionSetValue' to type 'System.IConvertible'.
at System.Convert.ToInt32(Object value) .
Below is my code:
int serviceProviderCountry = 0;
foreach (var v in serviceProDetails.Entities)
{
debugString += "\nSapId Found " +sapId;
serviceProviderCountry = Convert.ToInt32(v.Attributes["new_address1country"]);
Please suggest the correct syntax to for this conversion.
Thanks
Amrita
*This post is locked for comments