Change the task user

How I can change the user of the next task of my process in runtime? Or how can I get the user of the previous task?

Here is an example about how to change the user of a task instance from Delphi code.

You can do some integration with the scripting system to allow calling such a code and passing parameters (like the name of the user, for example). Note that this changes the user for a task that is already created, and you need to know the id of the task.
Also note that when creating a task definition, instead of inserting the name of user in the assignment, you can put a variable name between brackets. Thus during the workflow execution, you can just update that variable value with user id to make the specified task to be created for that use.

var TI : TTaskInstance;
    TI       := TTaskInstance.Create(nil);
    TI.Key   := ATaskIns.Key;

    TI.UserId := ‘someuser’;

Great, thanks