My process flow requires a manager to review an analyst's work and, if changes are needed, the manager can return the case to the same analyst or a different one. When changes are needed, I'd like to display the analyst's name to the manager and allow them to accept this analyst or select a new one.
When the analyst is originally assigned the task to do the work, I set a process variable "requestAssignee" and the task to do the work is assigned using that process variable. This variable contains the id of the user. On my manager form I have a People control that I default to the person associated with the "requestAssignee". Setting the People control to the value in "requestAssignee" causes the id of the user to be displayed. If the manager doesn't change the value in the People control, when completing the form, flow proceeds to the do work task but it isn't assigned to anyone. If the manager changes the analyst to a user, that user is properly assigned the do work task. How can I default a People control to a user so that it displays the user's name and can be used for the task assignment without the manager changing it?
For additional reference, I'm using form mappings to set the value of the analyst in the manager form:
Thanks
Thanks much for your answer. I was unable to import your sample, but by reading the xml and json files, I was able to mimic your prototype and this solved my initial issue.
There is still one scenario where I'm trying to set the assignee and it's still displaying as a number on the Manager's form. When the Do Work task is assigned to user 1, user 1 can use the built in capability on the top of the form to reassign the task to another user (i.e., user 2). User 2 works the task and it proceeds to the manager. The People control on the manager form now should display user 2's name. I've tried adding the following javascript to the Do Work task Complete task listener
task.getExecution().setVariable('requestAssignee', task.getAssignee());
But this causes the user's number to be displayed on the manager's form instead of the name.
Thanks
When you say it causes the users number (I assume id) to be displayed on the manager's form, what type of form field are you using? If you are using a People selector then it will show the user name not the id.
If you are displaying it in a regular input or text field, then indeed it will display the user id.
If you need the user name or email address, you need to use the userService to get that information.
Greg
I'm using a People control on the Manager form. It's defined as:
"fields": {
"1": [{
"fieldType": "FormFieldRepresentation",
"id": "requestAssignee",
"name": "Display Assignee",
"type": "people",
"value": null,
"required": false,
"readOnly": false,
"overrideId": true,
"colspan": 1,
"placeholder": null,
"minLength": 0,
"maxLength": 0,
"minValue": null,
"maxValue": null,
"regexPattern": null,
"optionType": null,
"hasEmptyValue": null,
"options": null,
"restUrl": null,
"restResponsePath": null,
"restIdProperty": null,
"restLabelProperty": null,
"tab": null,
"className": null,
"params": {
"existingColspan": 1,
"maxColspan": 2
},
"dateDisplayFormat": null,
"layout": {
"row": -1,
"column": -1,
"colspan": 1
},
"sizeX": 1,
"sizeY": 1,
"row": -1,
"col": -1,
"visibilityCondition": null
}
On the Do Work task that is immediately before the Manager form, I have the following task listener for the complete event:
"formreference": {
"id": 15027,
"name": "Do-Work",
"referenceId": null,
"variablesmapping": []
},
"fieldstovariables": "",
"duedatedefinition": "",
"prioritydefinition": "",
"categorydefinition": "",
"formproperties": "",
"tasklisteners": {
"taskListeners": [{
"event": "complete",
"implementation": "org.activiti.engine.impl.bpmn.listener.ScriptTaskListener",
"className": "org.activiti.engine.impl.bpmn.listener.ScriptTaskListener",
"expression": "",
"delegateExpression": "",
"$$hashKey": "uiGrid-000H",
"fields": [{
"name": "language",
"implementation": "javascript",
"stringValue": "javascript",
"expression": "",
"string": "",
"$$hashKey": "uiGrid-000N"
},
{
"name": "script",
"implementation": "task.getExecution().setVariable('requestAssignee', task.getAssignee());",
"stringValue": "task.getExecution().setVariable('requestAssignee', task.getAssignee());",
"expression": "",
"string": "",
"$$hashKey": "uiGrid-000T"
}]
}]
},
When the manager form is displayed, the id shows in the People control instead of the name:
Attached is a sample process flow where the user's Id is displayed instead of their name. To reproduce, on the "Do Work" form, change the Assignee. Log in as that assignee and complete the "Do Work" task. Log back in as the initiator to see the Manager Review form where the people control displays the Id instead of the name.
Thanks
Lauren
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.