I want to store the user ID of a user who completed a work item in a variable and then pass this to a worklet where a work item should be assigned to this same user. How can this be achieved?

In the standard YAWL distribution is a codelet called "TaskCompleterInfo" that can help here. It stores the user ID and the user name of the user who completed a certain task in a variable. This variable can then be passed on to the worklet as an input parameter and there it can be used in the resources dialogue to refer to a participant in the section net parameters.