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: