Hide a task automatically

1
0
-1

I'm currently developing a Human resources diagram for hiring people. Although the possiblity of failling is always present during the trials, I don't want to show the task of rejection until they have determined that the person failed at some point ( doesn't matter on which task they failed ).

  • I used an Inclusive Gateway to leave the possibility of doing the task "rejected" during the trials.
  • The task is assigned to the group "Human Resources" not to a single person (although only the head of human resources or his substitute (when on vacation) is going to do that)
  • I know that you manually can hide it, i want to know if there is a possibility of doing automatically

Thanks for your time

1 answer

1
+1
-1

Hello, yes, you can do it automatically using API. I don't have an exact script to share, but the key method is hideTasks . You will need to get the id of your user(s) and the id of the task in order to use it.

Here is a quick draft of a script that should help you start with (but you should test and probably adjust it):

  1. import org.bonitasoft.engine.bpm.flownode.HumanTaskInstance;import org.bonitasoft.engine.identity.Group;
  2. import org.bonitasoft.engine.identity.User;
  3. import org.bonitasoft.engine.identity.UserCriterion;
  4.  
  5. Group group = apiAccessor.getIdentityAPI().getGroupByPath("/acme/hr"); //get HR group
  6. List<User> listUsers = apiAccessor.getIdentityAPI().getUsersInGroup(group.getId(),0,10,UserCriterion.FIRST_NAME_ASC); // getall users from the group
  7. List<HumanTaskInstance> listTasks = apiAccessor.getProcessAPI().getHumanTaskInstances(processInstanceId, "Étape1", 0, 10);//get the id of task Step1 from the ongoing instance
  8. for (User user : listUsers) {
  9. apiAccessor.getProcessAPI().hideTasks(user.getId(), listTasks.get(0).getId()); //for each user from HR - hide the retrieved task
  10. }

You can put it in a Groovy connector on a service task, for example. Hope this helps, Haris

Comments

Submitted by efrados on Mon, 08/18/2014 - 13:20

Thanks for that! But i founded out that i want to do something else with the modelling... I want the task to make the person fail to be available (and hidden) BUT after failling, the trials should finish and my diagram doesn't model that , can you give me any help to model this idea? Here is my diagram the Xor is for different types of jobs that have different trials.

Submitted by efrados on Mon, 08/18/2014 - 13:24
Notifications