Get task attachment

I have uploaded the document in a task. I am not able to get that document using

processEngine.getTaskService()

.getTaskAttachments(task.getId());
I am not sure what exactly the attachment is in a task and where I can add it.

How have you uploaded the document? Through Java? Flowable Task UI? Something else?

@joram I have attached using Flowable UI

Not sure if I understood what you want to achieve, but I am using the following to get the documents uploaded by the user with Java code:

ContentEngineConfiguration contentEngineConfiguration = CommandContextUtil.getContentEngineConfiguration();
ContentService contentService = contentEngineConfiguration.getContentService();
		
ContentItemEntityManager ciem = contentEngineConfiguration.getContentItemEntityManager();

String contentId = (String) execution.getVariable("document");
ContentItemEntity cie = ciem.findById(contentId);
		
contentService.getContentItemData(cie.getId());

@douglascrp I am trying to fetch task attachments and notes. Is there any difference between the attachments and documents?

Well, I don’t know for sure.

The documents variable I used in my example to you was defined in the form as an upload field.