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 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.
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.