Custom data while completing the user task

Hi all,
I am using camunda 7 (Rest API) and below is my use case:

User 2 or 3 can reject the approval process (/engine-rest/task/:id/complete by passing a process variable say ‘isApproved’) and workflow goes back to User 1. However I would like to pass the reason for rejection while calling the complete api. So that I can see the reason for rejection as part of org.camunda.bpm.engine.rest.dto.history.HistoricTaskInstanceDto or some thing similar.
Example data: Rejected due to missing data
Is there any way that I can pass the custom data and retrieve the data as part of history. Users can reject multiple times. (i.e., User can provide rejection reason for each user task)

Thank you in advance.

Hi @camundabeginner,

you have to decide, in which structure the data should be kept. If you overwrite existing process variables with new values, the old values will be kept in the history, if you run with history level FULL. And you can retrieve them with this rest endpoint: Camunda Automation Platform 7.20.2 REST API

Or you can create variables, that are local to the tasks. But it’s more difficult to access the values later in the process instance.

Another option could be to add the comments to a generic list of comments.

Hope this helps, Ingo

2 Likes

Thank you @Ingo_Richtsmeier . I am trying with 1st approach as per suggestion which is more suitable for my case. Unfortunately we are using camunda 7.14 which I can’t find rest endpoint: Camunda Automation Platform 7.20.2 REST API

Would you suggest any other rest endpoint in 7.14 please

Thank you in advance

Hi @camundabeginner,

it’s here for 7.14: Get Historic Detail | docs.camunda.org

Hope this helps, Ingo

Hi @Ingo_Richtsmeier , Thank you
I tried this api by passing taskId but getting 404. Am I passing wrong Id?

Hi @camundabeginner,

I tried it by myself and only get valid responses, when I use the ID_ from the ACT_HI_DETAIL table.

If you look for the history of a variable, it is easier to use this request: Get Historic Details | docs.camunda.org with valid search criteria (a process instance id).

localhost:8080/engine-rest/history/detail?processInstanceId=67a69376-ba1a-11ee-a333-9ae8c9bb4c60

Hope this helps, Ingo

2 Likes

Thank you so much for this solution @Ingo_Richtsmeier
I am able to get the variables using localhost:8080/engine-rest/history/detail?processInstanceId=67a69376-ba1a-11ee-a333-9ae8c9bb4c60 and I can filter the variables using activityInstanceId for a specific user task.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.