I was able to debug out the problem. I can now use SetStateRequest to change the states of the quote.
I am stuck at another problem now. I have a scenario where I need to update the a quote field for a quote which is in Won state.
I do something like this in my JS code.
1. Change to draft state.
2. Change values and Save (using XRM.Page.data.save());
3. Change back to Active State
4. Change to Won State.
if I just do 1 and 2 above the code works fine the quote entity as the new values. However when I do 1-2-3 I get an exception that the object cannot be updated as it is readonly.
any clues?