I would like to code the following in Groovy:
- Change type for issue I from type T1 to type T2
- Since type T1 and type T2 have different workflow, I also need to set the status for issue I to one of the status included in the workflow for type T2.
- For simplicity, let's assume that whenever I change the type of an issue from T1 to T2, I want set the status of the issue to S1 (which is one of the status included in the workflow associated to the type T2).
So far I have been able to change issue type via
issue.setTypeId()
issue.store()
Since the type T1 and type T2 have two different workflows associated with them, I cannot use transitions to change the status.
So I tried to change the status id in the following way:
issue.setStatusId()
issue.store()
but this appears not to be enough. When I execute a transiton, the status transition to a status of the old workflow rather than the new one.
Any ides?