07-15-2021 04:18 AM
Hello,
I've tried to programmatically find and read file that was attached to business process. The process contains a form attached to star event including file attachment form field. When the process is started, the user will upload a file using the form.
I'd like to read and manipulate that file in a script task later in the process but cannot find a suitable method for reading the file.
I've tried so far:
All of the above return null values. Is there some other method for reading/listing attached files?
Thanks in advance!
07-16-2021 01:51 PM
You can also fetch the content by the process variable name with the below code
relatedContentService.getFieldContentForProcessInstance(
execution.getProcessInstanceId(), VARIABLE_NAME, 1, 0).getContent();
Have a look at this tutorial - https://hub.alfresco.com/t5/alfresco-process-services/getting-started-with-alfresco-process-services...
Also the other 2 methods you mentioned works with attachment I'd which is different from filename
Explore our Alfresco products with the links below. Use labels to filter content by product module.