elsa-core icon indicating copy to clipboard operation
elsa-core copied to clipboard

When a workflow is blocked, how can I programmatically go straight back to a blocked node that has been historically executed?

Open fearless87 opened this issue 3 years ago • 1 comments

Hello, there is a problem bothering me, please help me to check, thank you very much!

Requirements: When the workflow stays at a blocked node waiting for the user to approve, the user can choose to go back to any blocked node that the current workflow passes through.

Example:

  • Node 'Blocking Activities 2.1' is waiting for user Sam's approval, but the user manually rolls back to node 'Blocking Activities 1' image
  • After the rollback, the node stays in node 'Blocking Activities 1' image

Current programming implementation: Is there any other way to implement it?

  1. Delete all Bookmarks
  2. Add Bookmarks for the new node
  3. Rebuild the JSON in WorkflowInstances

Problems: There is no way to access the execution context 'OnExecuteAsync(ActivityExecutionContext context)' of node 'Blocking Activities 1'! Please help me,thanks.

fearless87 avatar Aug 25 '22 09:08 fearless87

i also have this problem and very anxious about how to deal with it.

asdge245871623 avatar Oct 05 '22 15:10 asdge245871623

i also have this problem

yeleibo avatar Oct 19 '22 09:10 yeleibo

i also have this problem 你把elsa-core ,引用到生产项目里吗?

asdge245871623 avatar Oct 20 '22 09:10 asdge245871623

i also have this problem 你把elsa-core ,引用到生产项目里吗?

no, i consider to use this

yeleibo avatar Oct 20 '22 09:10 yeleibo

@fearless87

Yes, the way to return back to a previous node is to connect to it using the designer. One thing to take care of however is that with Elsa 2, there has to be at least one root node (which means nou inbound connections).

In your case, I would just add a "dummy" activity between the Start button and the "Blocking Activities 1" activity. This dummy activity could be a simple "WriteLine" activity.

This way, you can connect any activity back to the "Blocking Activities 1" activity.

Here's an example of connecting an existing activity to another one:

https://miro.medium.com/max/720/1*m98zNmHo-O3gPqGaksrnBA.gif

I took the image from this blog post: https://sipkeschoorstra.medium.com/part-7-of-building-workflow-driven-net-applications-with-elsa-2-e369e7784555

sfmskywalker avatar Oct 20 '22 17:10 sfmskywalker