Hello,
Inside a listener, how can I get the value of a task field that has been set as an expression?
I have a task whose candidateGroups is equal to de following expression ${taskPropertyService.resolveCandidateGroups(execution)},
and I have a listener from where I am trying to get the value of the candidateGroups field, for each task instance that is created.
Is there any way to get the value of the expression resolved (instead of the expression itself)?
this is the code I have so far:
@EventListener
public void onExecutionEvent(ExecutionEntity executionEntity) {
final String activityId = executionEntity.getActivityId();
final String eventName = executionEntity.getEventName();
final boolean isStartEvent = "start".equals(eventName);
final boolean isUserTask =
executionEntity.getActivity().getActivityBehavior() instanceof UserTaskActivityBehavior;
if (isStartEvent && isUserTask) {
UserTaskActivityBehavior userTaskActivityBehavior = (UserTaskActivityBehavior) executionEntity.getActivity().getActivityBehavior();
String candidateGroups = userTaskActivityBehavior.
getTaskDecorator().
getTaskDefinition().
getCandidateGroupIdExpressions().
iterator().
next().
getExpressionText();
//candidateGroups = ${taskPropertyService.resolveCandidateGroups(execution)}
...
I am using SpringBoot
Thank you