How to invite/get all users who can approve a document
For example, you have Transition A -> B and you need to notify users which can approve (or reject) a document in Activity B. You have two options to do that.
1st option:
To notify users who can do something with your document in Activity B. You need to put a notification code to Activity B. Use Code Actions or IWorkflowActionProvider to do that. When you execute a transition from A to B, the implementation of Activity B will be executed.
2nd option:
You can write code that determines and notifies respective users in ProcessStatusChanged or OnProcessActivityChanged (in versions >= 1.5.5) event handlers.
You can take next user's ID in the following way:
var usersIds = await runtime.GetAllActorsForCommandTransitionsAsync(processInstance);
If you need to get a list of users who can do something with a parent process from a subprocess, you can use the following code (in versions >= 1.5.5):
using OptimaJet.Workflow.Core.Subprocess;
var filter = new TreeSearchFilter(processInstance) {
StartFrom = TreeSearchStart.FromRoot,
Include = TreeSearchInclude.OnlyStartPoint
};
var usersIds = await runtime.GetAllActorsForCommandTransitionsAsync(filter);