Below is an explanation how to get a value and label of an OptionSet field and set a value of an OptionSet field on the basis of lable in CRM 2015/2013 plugin.
Let’s say we had two fields on our form
1) Lock Resource
2) Status
We want to update Lock Resource field’s value on the basis of Status field’s value. In this case both fields are Option Set i.e. pick list
First in our Plugin we will get value of our status field by using code below
This will give us value of current status option set field.
Once we have this we need to use following RetrieveAttributeRequest to get data back
Once we have label we can use our logic for comparison and make a code decision
Below is a sample which can be used to get a list of all options in Lock Resource and on the basis of above results we can lock certain type of resource