How to get field optionset from entity reference ?
Thanks,
*This post is locked for comments
I have the same question (0)

How to get field optionset from entity reference ?
Thanks,
*This post is locked for comments
I have the same question (0)Hi,
This code is not correct, here you are trying get option set field from entity reference, if this option set is part of the opportunity entity, you need to first query opportunity entity using it's id and then you can fetch it. It should be something like below
Entity opportunity=service.Retrieve("opportunity",optId,new ColumnSet(new String[]{"swo_category"}));
int category=opportunity.GetAttributeValue<OptionSetValue>("swo_category").Value;
Let me know if you are facing any issue.
Thanks