How to read UserTask form fields in Spring Boot?

When a specific User Task is getting activated, want to read user form details (form fields) for that specific user form.
I’m using Spring Boot project @ZeebeWorker and the method is getting invoked when user task is getting activated. In this, able to read the Form Key but the form details (form fields) are not available.

@Component
public class UserTaskJobHandler implements JobHandler {

@Override
@ZeebeWorker(timeout = 2592000000L) // 30 days
public void handle(JobClient client, ActivatedJob job) {
. . . . .
. . . . .
}
}

  1. How to read the form details (form fields) for this specific user form key in Camunda 8 when user task is getting activated?

  2. Looks like, there is an TaskListener in Camunda 7 which is getting invoked when task is getting created and read the form fields from DelegateTask. How to perform this in Camunda 8?

Hi @dsathishcse, welcome to the forums! The formKey value should be the ID of the form, I believe, and you can then fetch the form definition using the Get Form REST API. The form is a JSON object that can be rendered by the form-js library.

Task listeners are not included with C8. If you are using a self-managed installation, you can create a custom exporter and trigger events based on the data feed.

Hi @nathan.loding Thanks for your reply. Since we are trying with self-managed version, Is there a way to retrieve the form definition or form fields without Tasklist API dependency?

There is not another endpoint to directly query the forms, I don’t think. I have not tried this myself, but you could look at the GET /v1/process-definitions/{key}/xml endpoint in Operate. The form JSON should be embedded in the XML; you would be looking for a <zeebe:userTaskForm /> element.

I was checking the this by reading it from bpmn xml but trying to see the alternate option. Thanks @nathan.loding