2 Replies Latest reply on Jun 19, 2015 11:02 AM by awizenm

    Is a "potentialOwner" string a kind of a "magic" variable in jBPM 6.2 ?   ;-)

    awizenm

      I was looking for any clear documentation on dealing with the potential owner in jBPM 6.2.

       

      How does the current API support setting of the potential owner for the task?

       

      Is the potential owner officially supported at all?

       

      There are API methods to look up the task assignment like e.g. this:

       

      taskService.getTasksAssignedAsPotentialOwner("userX", "en-UK");
      

       

      But the only way to set the potential owner I found, was this:

       

      params.put("potentialOwner", "userX");
      ProcessInstance processInstance = ksession.startProcess("myProcess", params);
      

       

      Is there at least a string constant in the jBPM code for that?

       

      Thank you for any advice!

        • 1. Re: Is a "potentialOwner" string a kind of a "magic" variable in jBPM 6.2 ?   ;-)
          awizenm

          OK, my question about the "potentialOwner" is a result of a confusion. The "potentialOwner" is just a parameter in my process definition. But there is a "potentialOwner" element in bpmn2 schema, which is apparently utilized by the jBPM implementation:

           

          <bpmn2:potentialOwner id="PotentialOwner_1">
              <bpmn2:resourceAssignmentExpression id="ResourceAssignmentExpression_1">
                <bpmn2:formalExpression id="FormalExpression_20">#{potentialOwner}</bpmn2:formalExpression>
              </bpmn2:resourceAssignmentExpression>
          </bpmn2:potentialOwner>
          

           

          I will try to remove this element entirely from my process definition and try to work with:

           

          userTaskService.nominate(taskId, userId, potentialOwners);
          
          • 2. Re: Is a "potentialOwner" string a kind of a "magic" variable in jBPM 6.2 ?   ;-)
            awizenm

            For today I have found some way to assign user using nominate.

            But I'm not really proud of it because using "Administrator" for this is also a "magic" trick.

             

                    long processInstanceId = processService.startProcess(StartupBean.PROCESSES_DEPLOYMENT_ID, "myProcess");
                    List<Long> tasksByProcessInstanceId = runtimeDataService.getTasksByProcessInstanceId(processInstanceId);
                    Long taskId = tasksByProcessInstanceId.get(0);
                    List<OrganizationalEntity> potentialOwners = new ArrayList<OrganizationalEntity>();
                    potentialOwners.add(new UserImpl(currentUser));
                    userTaskService.nominate(taskId, "Administrator", potentialOwners );
                    userTaskService.start(taskId, currentUser);
            

             

            I still appreciate any suggestion on how to do the user assignment the right way.