Change name of uploaded file

cancel
Showing results for 
Search instead for 
Did you mean: 
Jannik
Customer

Change name of uploaded file

Jump to solution

Hey guys,

I searched everything and can't find an appropriate answer - so I need your help!

My Process made with APS (Enterprise) starts with a form where the users can upload a contract (the id in that field is "contract"). Thing is, I want to unify that file to the filename "contract.docx".

Example: User uploads file "something.docx" and then it's published to ACS as "contract.docx".

For this I know I have to call the variable containing this file, but I can't find it - and the mess is that it is not stored in "contract", like all other variables from formfields are handled. In activiti-admin I can see the variable "contract" but it is "null".

So, do you know what to call exactly and further - how to change the filename?

Thanks and cheers,

Jannik

1 Solution

Accepted Solutions
Jannik
Customer

Re: Change name of uploaded file

Jump to solution

Fortunately I found something related. I changed the code a bit to my needs and it looks like this:

import com.activiti.service.runtime.RelatedContentService;
import com.activiti.domain.runtime.RelatedContent;

List<RelatedContent> contentList = relatedContentService.getFieldContentForProcessInstance(execution.getProcessInstanceId(), "contract", 1, 0).getContent();
RelatedContent content = contentList.get(0);
content.setName("Contract");

This works superb. Maybe it could help you as well. Just parse it to a groovy Scripttasks and your are g2g.

Cheers!

View solution in original post

1 Reply
Jannik
Customer

Re: Change name of uploaded file

Jump to solution

Fortunately I found something related. I changed the code a bit to my needs and it looks like this:

import com.activiti.service.runtime.RelatedContentService;
import com.activiti.domain.runtime.RelatedContent;

List<RelatedContent> contentList = relatedContentService.getFieldContentForProcessInstance(execution.getProcessInstanceId(), "contract", 1, 0).getContent();
RelatedContent content = contentList.get(0);
content.setName("Contract");

This works superb. Maybe it could help you as well. Just parse it to a groovy Scripttasks and your are g2g.

Cheers!