As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
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.
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.
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 logic2.I want to write a listener class which attaches the prepared file to a particular task3.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.