11-13-2018 07:38 AM
Greetings to All, Anyone know how to get taskService service reference in a class that implements the TaskListener to create an attachment.
If anyone can help it would be greatly appreciate.
11-14-2018 04:09 AM
If you look at the API of the DelegateTask you are passed in the listener, you will see that you can get a DelegateExecution via getExecution(), which in turn allows you to retrieve EngineServices via getEngineServices() - and if you look at that API, it allows you to retrieve various services, among them the TaskService.
Additionally, if you are developing in APS or another context with an annotation-based Spring dependency injection environment, you can simply have Spring inject the TaskService via @Autowired (provided you set your listener up to be a bean via @Component and access it via a delegate expression in your processes instead of a using it as a simple class-based listener).
Also note that, if you are working in APS, attachments are not handled via the TaskService. APS is a hack bolted on top of the core Activiti engine and it has its own RelatedContentService for dealing with attachments.
11-14-2018 08:41 AM
I have a file prepared and that has to be displayed in "Display Value" filed in the form.
Process:
1.File will be prepared based on some business logic
2.I want to write a listener class which attaches the prepared file to a particular task
3.finally i want to display the attached file in "Display Value" field in the form as mentioned above
any help will be would be greatly appreciate.
Explore our Alfresco products with the links below. Use labels to filter content by product module.