Hi everyone.
I'm working in an email notification task.
I'm trying to know if a task is assigned to a user or not.
If the task is assigned to a user I need the email of this user to send the notification, or if the task is unassigned I'm sending the notification to all the possible users.
If I want to extract this information from another task, i found the method getHumanTaskInstance from the processAPI(), but I need the activityInstanceId from the other task to obtain the information.
How can I get the activityInstanceId from another task?
Thanks.
Jorge
Hello,
What do you have to search the another activity instance? A CaseID and a task name ?
So use the Search operation (I'm not sure about the ActivityInstanceSearchDescriptor constant, have a look in the javadoc)
SearchOptionsBuilder searchActBuilder = new SearchOptionsBuilder(0, 1);
searchActBuilder.filter(ActivityInstanceSearchDescriptor.ROOTPROCESSINSTANCE, MyCaseId);
searchActBuilder.filter(ActivityInstanceSearchDescriptor.NAME, "MyTaskName");
SearchResult<ActivityInstance> searchFailedActivityInstance = processAPI.searchActivities(searchActBuilder.done());
if (searchFailedActivityInstance.getCount()>0)
activityInstanceId = searchFailedActivityInstance.getResult().get(0).getId();
By the way your use case seem to be take into account by the Email User job in TruckMilk
https://community.bonitasoft.com/project/pagetruckmilk-execute-jobs-intervalle
best
Hi,
I tried that code on my project and it worked like a charm.
Thank you very much!
Regards.
Super! Glad to have helped!