How to insert specific Status Reason values when the UI does not let you
I came across a problem today which no doubt I've had before but in this case I needed to find a resolution rather than simply working around the problem. I wanted to insert values on multiple "Status Reason" fields on child entities to match those set at the parent level but I wasn't able to via the standard interface because those values on the child entities had been previously allocated to options which had since been removed (NOTE: they had not yet been deployed as part of a solution)
As an example, take the "Status Reason" field on my child entity as shown below. When I click add we can see the Value is set to 592,780,003 and can't be changed rather than 592,780,000. This is because a number of values were added and then removed due to a change in requirements (remembering of course none of the solution had yet been deployed anywhere).
On my parent entity there is a value for 592,780,000 called "In Design" and I'd really like to add the same value here so that when I want to cascade the status changes down from the Parent to all the children it is a simple process and all the "Status Reason" values are consistent.
The solution involves simply invoking the InsertStatusValueRequest by code, my tool of choice when I need to do something like this is Linqpad.
And hey presto, after running it I see the Option Set item with the correct value I required.