Hi Camunda Team,
We are trying to get the task assignee first name and last name from camunda BPMN file. As part of the BPMN file we are adding task listeners and using assignment as script and event type as assignment and listener type as script and format as java script with type inline script.
Below is the BPMN diagram.
task.setVariable(“claimedBy”,task.getAssignee())
Here we are getting the task.getAssignee() which is returning userId, I need to get the Assignee first name and last name.
Below are the user/assignee details there in h2 database.
Before claiming the task the task will be looks like below.
After claiming the task we are not getting the task assignee firstname and lastname.
Below is the response from the task API from camunda UI.
{
"_links": {
"assignee": {
"href": "/user/user"
},
"execution": {
"href": "/execution/7a8b1d4e-ee01-11ef-96cc-103d1ca05358"
},
"identityLink": {
"href": "/task/7a8b1d51-ee01-11ef-96cc-103d1ca05358/identity-links"
},
"processDefinition": {
"href": "/process-definition/camunda4ic:1:28c38e71-ee00-11ef-96cc-103d1ca05358"
},
"processInstance": {
"href": "/process-instance/7a8af63b-ee01-11ef-96cc-103d1ca05358"
},
"self": {
"href": "/task/7a8b1d51-ee01-11ef-96cc-103d1ca05358"
}
},
"_embedded": {
"identityLink": [
{
"_links": {
"task": {
"href": "/task/7a8b1d51-ee01-11ef-96cc-103d1ca05358"
},
"user": {
"href": "/user/user"
}
},
"_embedded": null,
"type": "assignee",
"userId": "user",
"groupId": null,
"taskId": "7a8b1d51-ee01-11ef-96cc-103d1ca05358"
}
],
"processDefinition": [
{
"_links": {
"deployment": {
"href": "/deployment/28c207cf-ee00-11ef-96cc-103d1ca05358"
},
"resource": {
"href": "/deployment/28c207cf-ee00-11ef-96cc-103d1ca05358/resources/camunda4ic.bpmn"
},
"self": {
"href": "/process-definition/camunda4ic:1:28c38e71-ee00-11ef-96cc-103d1ca05358"
}
},
"_embedded": null,
"id": "camunda4ic:1:28c38e71-ee00-11ef-96cc-103d1ca05358",
"key": "camunda4ic",
"category": "http://bpmn.io/schema/bpmn",
"description": null,
"name": "Camunda4IC Task",
"versionTag": null,
"version": 1,
"deploymentId": "28c207cf-ee00-11ef-96cc-103d1ca05358",
"diagram": null,
"suspended": false,
"contextPath": null
}
],
"user": [
{
"_links": {
"self": {
"href": "/user/user"
}
},
"_embedded": null,
"id": "user",
*"firstName": "Mr",*
* "lastName": "UserA20",*
"email": "user@localhost"
}
]
},
"id": "7a8b1d51-ee01-11ef-96cc-103d1ca05358",
"name": "Camunda 4IC",
"assignee": "user",
"created": "2025-02-19T01:05:59.009+1100",
"due": null,
"followUp": null,
"delegationState": null,
"description": null,
"executionId": "7a8b1d4e-ee01-11ef-96cc-103d1ca05358",
"owner": null,
"parentTaskId": null,
"priority": 50,
"processDefinitionId": "camunda4ic:1:28c38e71-ee00-11ef-96cc-103d1ca05358",
"processInstanceId": "7a8af63b-ee01-11ef-96cc-103d1ca05358",
"taskDefinitionKey": "FourICUserTask",
"caseExecutionId": null,
"caseInstanceId": null,
"caseDefinitionId": null,
"suspended": false,
"formKey": null,
"camundaFormRef": null,
"tenantId": null
}
Is there any way to get the task assignee firstname and lastname instead of userId.
Below is the BPMN diagram we are using.
camunda4ic.bpmn (4.8 KB)
Thanks,
Ram