Hello, I'm trying to set the value of an option set field in my C# code but I am running into difficulties. I found some code examples but they are not working for me. I am using the following code:
IPluginExecutionContext context = localContext.PluginExecutionContext; IOrganizationService service = localContext.OrganizationService; ITracingService tracingService = localContext.TracingService; if (localContext == null) { throw new ArgumentNullException("localContext"); } Entity targetEntity = null; targetEntity = (Entity)context.InputParameters["Target"]; targetEntity.Attributes.Add("apd_emailstatus", new OptionSetValue(921050001));
I have the correct name for the field and the correct value, but nothing is happening when I run my code. I have my plugin set to Post-Operation running Async on Update. Does anyone have any ideas? Thank you in advance.
Mike Karls