I am attempting to create a custom field in youtrack who's value changes along with state changes in another field. I was wondering if there was a simple way to make this field read-only in the UI so that it cannot get out of sync with what it should be.
My current solution is to assert the correct states in a changed event (my actual rule is more complex):
rule Department should only be changed automatically
when Department.changed {
var message = "Department change not allowed";
assert Department != {Product Management} || State != {Submitted}: message;
assert Department != {Development} || (State != {Open} && State != {In Progress}): message;
}
The issue is that if I want to tweak the state machine driving everything, I need to remember to come back to this rule as well to make sure everything remains consistent. Is there a better way to achieve this?