Retrieve timer value from a Java list

Hello,

I have the following workflow :

In the service task P0, I’m setting an array list as Variable :

  List<PersonInfo> personInfos = Arrays.asList(new PersonInfo("1","100","2022-06-06T06:45:00"),
                new PersonInfo("2","100","2022-06-06T08:45:00"));

        delegateExecution.setVariable("personInfoList", personInfos);

This array list will be used in the subprocess.

I want to know how I can configure the timer such it can use the date (3rd element) from the arrayList and set it on the timer.

Anyone can help on this please ?

I set an expression on the timer value : #{timervalue} and add an ExecutionListener.

Event type : start , Listener Type : Java class and in the java class, I set the expression value as variable.

  PersonInfo value = (PersonInfo) execution.getVariableTyped("personInfo").getValue();
        execution.setVariable("timervalue",value.getDate());

When I start my process, I have the following error :

Cannot instantiate process definition personProcess:2:79a399f6-e597-11ec-9e2f-fcb3bc607fe9: Unknown property used in expression: #{timervalue}. Cause: Cannot resolve identifier 'timervalue'

Why can’t we set the timervalue in the ExecutionListener ?

Have you come across this post yet? Unable to use execution.setVariable() in listener inline script It may be able to answer your question.

Best Regards,
dg

Hello @davidgs

I don’t want to use script task. I want to set the value from a Java class. Any other suggestion how can I achieve this ?