CYP - task assignment
This workflow is included in the Local Government Essentials - Task Allocation and Types Package package.
Description
Allocates team and team member based on various criteria.
Properties
This workflow has the following properties.
| Property | Value |
|---|---|
| Name | CYP - task assignment |
| Code | workflows_cYPTaskAssignment_856362b683ed15d5e1de24bb |
| Type | Workflow |
| Context | Package |
| Enabled | Yes |
| Tags | Causeway |
| Runs on | Working days and hours only (Both) |
| Log retention | 30 days |
Trigger
A user triggers this workflow on demand, or another workflow runs it (via an MWR). It works on the items of the design below.
| Property | Value |
|---|---|
| Workflow type | Manual workflow |
| Applies to | Tasks with task types |
| Collections | Live |
| Output mode | ManyItems (Runs once for all items) |
| Parameters design | MTP - workflows_cYPTaskAssignment |
| Output action | The Filter action highlighted in the diagram below |
Actions
This workflow runs 6 actions, in the order shown in this simplified diagram. Every action's full settings are in the configuration below.
Configuration
The full configuration of this workflow, including every action's parameters.
Show configuration (316 lines)
{
"trigger": {
"dodiCode": "designInterfaces_tasksWithTaskTypes",
"outputMode": "ManyItems",
"collections": [
"Live"
],
"parametersDesignCode": "designs_mTPWorkflowscYPTaskAssignment_8d22bc6270f38b00a749d7d4",
"outputActionId": "879c2f84b463b09a47ca0981"
},
"actions": [
{
"actionId": "879c2f84b463b09a47ca0981",
"designCode": "designs_workflowFilterAction",
"description": "",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowFilterActionsAqsQuery",
"value": {
"type": "Query",
"properties": {
"dodiCode": "designInterfaces_tasksWithTaskTypes",
"collectionCode": "Live",
"attributes": [
"attributes_itemsTitle",
"attributes_itemsSubtitle"
]
},
"children": [
{
"type": "NotExists",
"children": [
{
"type": "Attribute",
"properties": {
"attributeCode": "attributes_tasksTeam"
}
}
]
}
]
},
"attributeType": "Aqs"
}
}
],
"variables": [],
"actions": [
{
"actionId": "8315655d0b8ba520e0113290",
"designCode": "designs_workflowRelationAction",
"description": "designInterfaces_assetAreaManagement_8c3d5027cf27aff9962834c7",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowRelationActionsAqsPath",
"value": "root^attributes_tasksAssignableTasks<designInterfaces_assetAreaManagement_8c3d5027cf27aff9962834c7>",
"attributeType": "String"
}
}
],
"variables": [],
"actions": []
},
{
"actionId": "814ff9f84ced5e753a1681b3",
"designCode": "designs_workflowQueryAction",
"description": "Asset Area Management",
"parameters": [
{
"attributeCode": "attributes_workflowQueryActionsAqsQuery",
"value": {
"script": "var conditions = new List<object>();\r\n\r\nvar queryMain = new \r\n{\r\n type = \"Query\",\r\n properties = new {\r\n collectionCode = new[] { \"Live\" },\r\n dodiCode = \"designs_taskAllocationList_88b645d4192c743418ffdb51\"\r\n },\r\n children = new object [] \r\n {\r\n new \r\n {\r\n type = \"Or\",\r\n children = conditions\r\n }\r\n }\r\n};\r\n\r\n//task type\r\nconditions.Add(new \r\n{\r\n type = \"Equals\",\r\n children = new object [] {\r\n new \r\n {\r\n type = \"ItemProperty\",\r\n properties = new \r\n {\r\n itemPropertyName = \"ItemId\",\r\n path = \"root.attributes_taskAllocationListTaskType_82b2a67dbc88e191e5f36f2c\"\r\n }\r\n },\r\n new\r\n {\r\n type = \"AlloyId\",\r\n properties = new \r\n {\r\n value = taskType\r\n }\r\n },\r\n }\r\n});\r\n\r\n// subarea\r\nif(subArea?.Any() == true)\r\n{\r\n conditions.Add(new \r\n {\r\n type = \"Equals\",\r\n children = new object [] {\r\n new \r\n {\r\n type = \"ItemProperty\",\r\n properties = new \r\n {\r\n itemPropertyName = \"ItemId\",\r\n path = \"root.attributes_taskAllocationListSubOperationalArea_8ad96ad6dc08d006097058cf\"\r\n }\r\n },\r\n new\r\n {\r\n type = \"AlloyId\",\r\n properties = new \r\n {\r\n value = subArea\r\n }\r\n }\r\n }\r\n });\r\n}\r\n\r\n\r\nif(area?.Any() == true)\r\n{\r\n conditions.Add(new\r\n {\r\n type = \"Equals\",\r\n children = new object [] {\r\n new \r\n {\r\n type = \"ItemProperty\",\r\n properties = new \r\n {\r\n itemPropertyName = \"ItemId\",\r\n path = \"root.attributes_taskAllocationListOperationalArea_8ac4bf99ace1cace1142732c\"\r\n }\r\n },\r\n new\r\n {\r\n type = \"AlloyId\",\r\n properties = new \r\n {\r\n value = area\r\n }\r\n }\r\n }\r\n });\r\n}\r\n\r\nif(ward?.Any() == true)\r\n{\r\n conditions.Add(new\r\n {\r\n type = \"Equals\",\r\n children = new object [] {\r\n new \r\n {\r\n type = \"ItemProperty\",\r\n properties = new \r\n {\r\n itemPropertyName = \"ItemId\",\r\n path = \"root.attributes_taskAllocationListWard_8a117cd1747aa91b77e5ba00\"\r\n }\r\n },\r\n new\r\n {\r\n type = \"AlloyId\",\r\n properties = new \r\n {\r\n value = ward\r\n }\r\n }\r\n }\r\n });\r\n}\r\n\r\nreturn Aqs(queryMain);",
"returnOptions": {
"dodiCode": "designs_taskAllocationList_88b645d4192c743418ffdb51"
}
},
"attributeType": "Aqs"
},
{
"attribute": {
"attributeCode": "attributes_workflowQueryActionsSingleInstance",
"value": true
}
}
],
"variables": [
{
"name": "taskType",
"value": {
"inputParent": 0,
"itemValue": {
"attributeCode": "attributes_tasksWithTaskTypesTaskType"
}
},
"attributeType": "Link"
},
{
"name": "subArea",
"value": {
"outputAction": "8315655d0b8ba520e0113290",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_assetAreaManagementSubOperationalArea_86a18c975cf6af06bd0fd60a"
}
},
"attributeType": "Link"
},
{
"name": "area",
"value": {
"outputAction": "8315655d0b8ba520e0113290",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_assetAreaManagementOperationalArea_80ef3bc80ae7207498ec51fe"
}
},
"attributeType": "Link"
},
{
"name": "ward",
"value": {
"outputAction": "8315655d0b8ba520e0113290",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_assetAreaManagementWard_8f1fb1c9771bf6592503a3d6"
}
},
"attributeType": "Link"
}
],
"actions": []
},
{
"actionId": "8d8faea5eaa451b95df379cd",
"designCode": "designs_workflowOutputAction",
"description": "Find the task allocation list with highest priority",
"parameters": [
{
"attributeCode": "attributes_workflowOutputActionItems",
"value": {
"script": "var taskAllocationListIds = Variables.taskListId.AllValues.Select(x => x.Value.SingleValue.Single()).ToArray();\r\nvar allSubAreas = Variables.taskListSubArea.AllValues.Select(x => x.Value.SingleValue?.SingleOrDefault()).ToArray();\r\nvar allAreas = Variables.taskListArea.AllValues.Select(x => x.Value.SingleValue?.SingleOrDefault()).ToArray();\r\nvar allWards = Variables.taskListWard.AllValues.Select(x => x.Value.SingleValue?.SingleOrDefault()).ToArray();\r\nvar allTypes = Variables.taskListTaskType.AllValues.Select(t => t.Value.SingleValue.Single()).ToArray();\r\n\r\nvar taskType = Variables.taskType.SingleValue.Single();\r\nvar subArea = Variables.subArea.SingleValue?.SingleOrDefault();\r\nvar area = Variables.area.SingleValue?.SingleOrDefault();\r\nvar ward = Variables.ward.SingleValue?.SingleOrDefault();\r\n\r\nvar listy = Enumerable\r\n .Range(0, taskAllocationListIds.Length)\r\n .Select(i => new { id = taskAllocationListIds[i], s = allSubAreas[i], o = allAreas[i], w = allWards[i], t = allTypes[i]})\r\n .Where(x => x.t.Equals(taskType))\r\n .ToArray();\r\n\r\nvar firstWithSubArea = listy.FirstOrDefault(x=>x.s?.Equals(subArea) ?? false)?.id;\r\nvar firstWithArea = listy.FirstOrDefault(x=>x.o?.Equals(area) ?? false)?.id;\r\nvar firstWithWard = listy.FirstOrDefault(x=>x.w?.Equals(ward) ?? false)?.id;\r\n\r\nvar firstTaskList = firstWithSubArea ?? firstWithArea ?? firstWithWard;\r\n\r\nreturn firstTaskList == null ? null : new [] { firstTaskList };\r\n"
},
"attributeType": "Link"
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionDodiCode",
"value": "designs_taskAllocationList_88b645d4192c743418ffdb51"
}
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionSingleInstance",
"value": false
}
}
],
"variables": [
{
"name": "taskType",
"value": {
"inputParent": 0,
"itemValue": {
"attributeCode": "attributes_tasksWithTaskTypesTaskType"
}
},
"attributeType": "Link"
},
{
"name": "subArea",
"value": {
"outputAction": "8315655d0b8ba520e0113290",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_assetAreaManagementSubOperationalArea_86a18c975cf6af06bd0fd60a"
}
},
"attributeType": "Link"
},
{
"name": "area",
"value": {
"outputAction": "8315655d0b8ba520e0113290",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_assetAreaManagementOperationalArea_80ef3bc80ae7207498ec51fe"
}
},
"attributeType": "Link"
},
{
"name": "ward",
"value": {
"outputAction": "8315655d0b8ba520e0113290",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_assetAreaManagementWard_8f1fb1c9771bf6592503a3d6"
}
},
"attributeType": "Link"
},
{
"name": "taskListId",
"value": {
"outputAction": "814ff9f84ced5e753a1681b3",
"itemValue": {
"property": "ItemId"
}
}
},
{
"name": "taskListSubArea",
"value": {
"outputAction": "814ff9f84ced5e753a1681b3",
"itemValue": {
"attributeCode": "attributes_taskAllocationListSubOperationalArea_8ad96ad6dc08d006097058cf"
}
}
},
{
"name": "taskListArea",
"value": {
"outputAction": "814ff9f84ced5e753a1681b3",
"itemValue": {
"attributeCode": "attributes_taskAllocationListOperationalArea_8ac4bf99ace1cace1142732c"
}
}
},
{
"name": "taskListWard",
"value": {
"outputAction": "814ff9f84ced5e753a1681b3",
"itemValue": {
"attributeCode": "attributes_taskAllocationListWard_8a117cd1747aa91b77e5ba00"
}
}
},
{
"name": "taskListTaskType",
"value": {
"outputAction": "814ff9f84ced5e753a1681b3",
"itemValue": {
"attributeCode": "attributes_taskAllocationListTaskType_82b2a67dbc88e191e5f36f2c"
}
}
}
],
"actions": [
{
"actionId": "8ee88338a14f39d90712350f",
"designCode": "designs_workflowOutputAction",
"description": "back to the task",
"parameters": [
{
"attributeCode": "attributes_workflowOutputActionItems",
"value": {
"inputParent": 1,
"itemValue": {
"property": "ItemId"
}
},
"attributeType": "Link"
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionDodiCode",
"value": "designInterfaces_tasksWithTaskTypes"
}
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionSingleInstance",
"value": false
}
}
],
"actions": [
{
"actionId": "8002fe2d506439d84cbbfd7f",
"designCode": "designs_workflowEditItemAction",
"description": "Edit task",
"parameters": [
{
"attributeCode": "attributes_tasksTeam",
"value": {
"inputParent": 1,
"itemValue": {
"attributeCode": "attributes_taskAllocationListDefaultTeam_8ff977c0a228b11fa3cc5453"
}
},
"attributeType": "Link"
},
{
"attributeCode": "attributes_tasksTeamMember",
"value": {
"inputParent": 1,
"itemValue": {
"attributeCode": "attributes_taskAllocationListTeamMember_81f44674aa6a66eacd30356c"
}
},
"attributeType": "Link"
}
],
"variables": [],
"actions": []
}
]
}
]
}
]
}
]
}