05-17-2017 04:17 AM
Hi all,
I have following business case:
User wants to receive notifications N days before particular task due date. Moreover, there is possibility to change due date from application.
So, I've created user task and timer boundary event, which is connected with it. Everything works fine - when user task is active in process, notification is sent to the user on calculated date based on process variable. However, timer boundary event does not finish user task. In this case, when timer boundary event is fired and job is completed, user can change due date in application and expects next notification N day before new due date. Unfortunately, when user changes due date, new job is not created. I suppose I have to create it manually, but API does not allow such kind of operation. I am able to do it by direct iBatis call:
dbSqlSession.getSqlSession().insert("insertTimer", timerEntity);
It is not good solution. Could you please help me with this case? Thank you in advance.
05-17-2017 02:58 PM
Assuming you have the TimerEntity definition, have you tried:
import org.activiti.engine.impl.context.Context;
...
...
Context.getCommandContext().getJobEntityManager().schedule(myTimerEntity);
Ultimately it does the same thing you are doing, but you aren't making an explicit iBatis call.
Let me know how it goes.
Greg
P.S. Id be interested in how you are retrieving/constructing the TimerEntity since it will be gone as soon as the timer fires.
05-18-2017 02:57 AM
Thank you for your response.
I figured it out and it works now. For new timers (jobs) I use:
commandContext.getJobEntityManager().insert(timerEntity);
Explore our Alfresco products with the links below. Use labels to filter content by product module.