- Create a WorkflowInbox table (Id, ProcessId, IdentityId).
- Subscribe to ProcessStatusChanged event in WorkflowRuntime and run the following algorithm:
- Delete all records from the WorkflowInbox table for the current ProcessId.
- Using GetAllActorsForDirectCommandTransitions, get IDs of all users who can execute commands for the current Activity.
- Add the necessary records to WorkflowInbox table based on the data from the previous step.
- To get the list of incoming processes, filter the IdentityId field in the WorkflowInbox table.
- To calculate the list of incoming documents, clear the WorkflowInbox table and call GetAllActorsForDirectCommandTransitions for every active process. If there are a lot of active processes, this operation may take a long time.
A list of documents agreed upon by the user (or his assistant) can be obtained by filtering WorkflowProcessTransitionHistory table by ExecutorIdentityId and ActorIdentityId fields.