I have written some code that programmatically creates a new optionset value in a multiselect optionset.
The code works fine when executing on my local machine (which points to Dynamics 365 development server).
This code will run in a plugin and when I upload the plugin to the development server and perform the action that triggers the code then the code fails with a null reference exception on this line:
var resp = (InsertOptionValueResponse)_service.Execute(insertOptionValueRequest);
I can't figure out why, if anyone has any input it would be much appreciated.
InsertOptionValueRequest insertOptionValueRequest = new InsertOptionValueRequest { AttributeLogicalName = "releye_salesexcellenceassessmentforms2", EntityLogicalName = Lead.EntityLogicalName, Label = new Label(text, 1033), }; var resp = (InsertOptionValueResponse)_service.Execute(insertOptionValueRequest);