So are you trying this to work as a part of the workflow transition or how are you trying to do it?
Through workflow this can be achieved using a Scriptrunner plugin. If you have scriptrunner plugin even it will be easy to achieve this using the Behaviours in the plugin.
If not you can create another field and in the description of that field you can add some code in it and meet your requirements.
This link might be handy for you to achieve this. But what you need to change is the field which you are actually looking at. The link defines it with respect to priority which isn't in your case.
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events