I faced the same issue as described in
Unfortunately, solutions based on OSWf objects didn't work for me (btw: I found valuable go through its concepts: http://oswf.sourceforge.net/tutorial/index.html).
I found this as appropriate solution:
final String newStatusId = ComponentAccessor.workflowManager.getNextStatusIdForAction(issue , transientVars['actionId'] as int)
Comments to the code:
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