Execute some logic before any PARTICIPANT step in a generic way
Hi, I want to execute some code before the transition to any PARTICIPANT step to set up some properties in the workflow (mostly to be used in the email template)
I know that I can create a process step and execute it before any PARTICIPANT step but it doesn't seems to be the best way to solve this problem.
Another alternative I'm thinking is to create an EventHandler that set the properties in a NodeTransition to a PARTICIPANT step.
But I have two questions:
.- Is there any way to guarantee that this handler will be executed before the EMailNotificationService event handler?
If there is no way to guarantee this, is there any other way to achieve my requirement (execute some code before a PARTICIPANT step in a generic way)
.- For some reason when the new handler update the workflow the changes are not persisted.
I tried two alternatives but none are working:
WorkItem currentItem = (WorkItem) event.getProperty(WorkflowEvent.WORK_ITEM); currentItem.getWorkflowData().getMetaDataMap().put("test", "test");and:
String instanceId = (String) event.getProperty(WorkflowEvent.WORKFLOW_INSTANCE_ID); // wfSession came from an addmin session -> repository.loginAdministrative(null) Workflow workflow = wfSession.getWorkflow(instanceId); workflow.getWorkflowData().getMetaDataMap().put("test2", "test2"); wfSession.getSession().save();Do I have to do something else to set up workflow properties?
Regards, Claudio.