# Going back in workflow

**URL:** <https://forum.flowable.org/t/going-back-in-workflow/3134>\
**Category:** Uncategorized\
**Created:** [December 27, 2018, 9:16am UTC](https://forum.flowable.org/t/going-back-in-workflow/3134 "2018-12-27T09:16:38Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![amstitan99](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/amstitan99/32/1228_2.png) [@amstitan99](https://forum.flowable.org/u/amstitan99)\
**Post date:** [May 22, 2019, 8:39am UTC](https://forum.flowable.org/t/going-back-in-workflow/3134/3 "2019-05-22T08:39:50Z")

</div>

Hi,

i have tried your code in rest api project but not sure about the state has been change or not please guide me how can i test that my current task has been change or not.

Task currentTask = taskService.createTaskQuery().taskId(currentTaskId).singleResult();

HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstanceId).orderByHistoricTaskInstanceEndTime().desc().list().get(0);

runtimeService.createChangeActivityStateBuilder().processInstanceId(currentTask.getProcessInstanceId()).moveActivityIdTo(currentTask.getTaskDefinitionKey(), historicTaskInstance.getTaskDefinitionKey());

Please guide me.

---

_[View the full topic](https://forum.flowable.org/t/going-back-in-workflow/3134)._
