Trying to connect JSON string (output of script task) as input for Camunda 7 Form to create dynamic checkbox

Hi, I’m new to Camunda and trying to build a simple form in which I use an output of a script task as input for a dynamic checkbox (in Camunda 7 Forms). I’m using Camunda 7 Run, but when I’m loading in the form + bpmn file I just see a checkbox without the input of the JSON string. Can someone help? The output of the script task is a string with all the users currently in Camunda.

Script task:
// Retrieve the list of users from the Identity Service
def userList = identityService.createUserQuery().list()

// Transform the user list into a JSON-friendly format (only first names)
def userOptions = userList.collect { user →
[
label: user.id,
value: user.firstName
]
}

// Convert the list into a JSON string
def userChecklistJson = new groovy.json.JsonBuilder(userOptions).toString()

// Set the JSON string as a process variable
execution.setVariable(“userChecklistJson”, userChecklistJson)
listofusers.bpmn (3.6 KB)

As input in the forms I have created a checkboxgroup with option source: expression
= JSON.parse(userChecklistJson)
formlistofusers.form (526 Bytes)

But it looks like the list of users is not connected to the checkbox, how to fix this? Thanks in advance!

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