cancel
Showing results for 
Search instead for 
Did you mean: 

How to Assign a Task to the User Manager?

Gregory_Carlin
Elite Collaborator
Elite Collaborator

Hello,

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.$.cnx.client.user.properties.manager;
        console.log("manager is: "+manager);
        var wf_instance_id = this.task.workflowInstanceId;
        console.log("wf_instance_id is: "+wf_instance_id);
        this.params.name = "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!

3 REPLIES 3

Thierry_Martins
Star Collaborator
Star Collaborator

Do you have a stacktrace when CurrentUser["user

Gregory_Carlin
Elite Collaborator
Elite Collaborator

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

Patrick_Abgrall
Star Contributor
Star Contributor

A User is not a Document... See https://doc.nuxeo.com/nxdoc/how-to-assign-a-task-to-the-user-manager/ for a simple proposal of solution to this problem of assignment of tasks to a third party to the workflow participants.

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.