How to Set a Option Set value in post create plugin CRM 2011

This question is not answered

I am  trying  to update option set value using post create plugin. 

Below is the code.

entity.Attributes.Add(

 "shippingmethodcode", new OptionSetValue(shippingMethodValue));

 

//  where shippingmethodvalue is int

When  i try to save this value, i get the following error :  Specified case is not valid.

Can you plz  let me know  , how to update option set value using plugin.

Thanks in Advance !!!

All Replies
  • Hello ,

    try this: entity["shippingmethodcode"] = new OptionSetValue(shippingMethodValue); Are you sure that the value in shippingMethodValue is proper value defined for shippingmethodcode pick list?

    Best regards RV