I have a problem when I do the reject operation on a userTask element, as shown in the picture below: I want to reject current userTask to specified userTask element. The problem is that how to find all userTask elements before the current userTask element.

This might be difficult, since you have to define first, what before means.
a) visually (x-coordinate)
b) flow-wise
In terms of b), you could solve this by chaining through the incoming properties and then identify bpmn:UserTask elements.
Closing old topics. If you have a similar question or need further assistance, please create a new topic and link to this one for context. Thank you!