How to Assign a Task to the User Manager?


Assuming I have created a custom user field called user:manager to store the user manager information, I would like to dynamically assign a task to him. So the scenario is: jdoe execute a task, then the second task is routed the the jdoe's manager (corresponding to the manager property of the last task performer). My idea is ti use a workflow global variable to store the manager info, and then use WorkflowVariables["manager_info"] to assign the task. I've tried a lot of options in Modeler, but not of them seems to work. In the first task, I'm using an automation chain that uses the Context.SetWorkflowVar operation but none of these tries work:

  • CurrentUser["user:manager"]] (gives a nullpointer)
  • CurrentUser.ActingUser
  • CurrentUser.getProperty("user:manager")
  • CurrentUser.getPrincipal().getModel().getPropertyValue("user:manager");

To be clear, CurrentUser should refer to the user performing the first task (jdoe in our case) What should I do?

I've taken another approach, by putting the logic on the UI Side with things like

        var manager = this.$;
        console.log("manager is: "+manager);
        var wf_instance_id = this.task.workflowInstanceId;
        console.log("wf_instance_id is: "+wf_instance_id); = "user_level_2";
        this.params.value = manager;
        this.$.SetWorkflowVar.execute().then(function(result) {

but it can't be recommanded becauce it can be hacked easily, and a user could replace the manager variable with another username.

Thx for your help!

FILES:   log.txt
0 votes

1 answers



Do you have a stacktrace when CurrentUser["user:manager"] gives a null pointer?

I've attached the log file with the different options I've taken. They are separated by ###

A User is not a Document… See for a simple proposal of solution to this problem of assignment of tasks to a third party to the workflow participants.

0 votes