How to restart a workflow from UI action

Yashaswini
Tera Expert

Hi,

Could you please tell me how to restart a workflow from UI action?

Have used below script:

UI Action

Table:sc_req_item

new Workflow().restartWorkflow(current, true);
current.state = '1';
current.update();
action.setRedirectURL(current);

 

This script restarts the workflow,but the issue is if there are 2 levels of approval and 1st level of approval is approved and 2nd is requested, when this UI action button is clicked 1st level of approval is still in approved state. I want to restart the approvals as well.

Kindly request you to suggest solution for this.

 

Regards,

Yashaswini

7 REPLIES 7

Thank you for replying.

Tried the above code in UI action. The 2nd level of approval is set to not requested, but first level is still in approved state.

And also workflow is not attached to RITM. PFA

 

Regards,

Yashaswini

Also tried using Roll back to activity in workflow.

This set the approvals 1st level to requested and 2nd level of approval to not requested.

When I again approve the 1st level, the workflow is cancelled.

Please suggest solution for either of these

 

Regards,

Yashaswini

Also tried using Roll back to activity in workflow.

This set the approvals 1st level to requested and 2nd level of approval to not requested.

When I again approve the 1st level, the workflow is cancelled.

Please suggest solution for either of these

 

Regards,

Yashaswini