cancel
Showing results for 
Search instead for 
Did you mean: 

Attaching file as a form field of custom form UI

shagufta1
Champ in-the-making
Champ in-the-making
I am using Activiti Rest API for fetching, initiating and completing the task. I have my own form UI and there is file attachment field. I am hitting "http://localhost:8080/activiti-app/api/enterprise/task-forms/'+taskId for completing the task. I tried to convert file into JSON text but it gives me bad request error. So what can be solution to upload file as an attachment of a form field via my servlet.
1 ACCEPTED ANSWER

cjose
Elite Collaborator
Elite Collaborator
Even though you are creating the process instance via REST API, attach a start form to the start activity. Keep an attach field in the start form.

Then do the following.
http://localhost:8080/activiti-app/api/enterprise/content/raw [this will upload the content to activiti]
Now start the process instance http://localhost:8080/activiti-app/api/enterprise/process-instances and pass the id value returned by the previous REST call in the request.
For example assume that you get "id": 1001 in response while uploading the content. If your attachment field id in the form is "attach-field", you will need to start the process instance by passing in {"values":{"attach-field":"1001"} in the request.

Hope this helps.

Cheers,

View answer in original post

10 REPLIES 10

olylak
Champ on-the-rise
Champ on-the-rise

Hello Ciju,

Could you please advise the following:

In the middle of the process I collect the data and submit it to a web service using REST task step to the third-party system to generate a document. The result of that call (PDF document) is stored using REST API into the process instance.

The question is how to show that document on the next steps form using Display Value or any other standard functionallity? 

Any advice would be appreciated.

Thanks in advance.

Regards,

Oleh.