Skip to main content

Generate tasks for Schedules

This workflow is included in the Scheduling package.

Description​

Generate tasks for the supplied schedules and date range, and advance the periodicities next dates.

Properties​

This workflow has the following properties.

PropertyValue
NameGenerate tasks for Schedules
Codeworkflows_generateTasksForSchedules_83daf473e645176dfaff63dd
TypeWorkflow
ContextPackage
EnabledYes
TagsCauseway
Log retention7 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.

PropertyValue
Workflow typeManual workflow
Applies toSchedules
Output modeManyItems  (Runs once for all items)
Parameters designMTP - Generate tasks for Schedules
Output actionThe Run workflow (MWR) action highlighted in the diagram below

Actions​

This workflow runs 21 actions, in the order shown in this simplified diagram. Select an MWR action to open the workflow it runs. Every action's full settings are in the configuration below.

Configuration​

The full configuration of this workflow, including every action's parameters.

Show configuration (768 lines)
{
"trigger": {
"dodiCode": "designInterfaces_schedule_8bbf2c5dac22df0ab9d7e055",
"parametersDesignCode": "designs_generateTasksForSchedules_83daf473e645176dfaff63dd",
"outputActionId": "880b4235bc3bd47503ffbb0a",
"outputMode": "ManyItems"
},
"actions": [
{
"actionId": "81176071c6ba35557a83acab",
"designCode": "designs_workflowRelationAction",
"comments": "Navigate to project to clone in template collection",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowRelationActionsAqsPath",
"value": "root.Template:attributes_scheduleLiveOrTemplateProject_8e78cba487983ce05e5f0dc3"
}
}
],
"actions": []
},
{
"actionId": "880b4235bc3bd47503ffbb0a",
"designCode": "designs_computeDatesFromSchedules_8e51c150022e2c7e705e9223",
"comments": "Get schedules next dates",
"parameters": [
{
"attributeCode": "attributes_computeDatesFromSchedulesDateRangeStart_800d6f68feb01147ef0d2035",
"value": {
"parameterCode": "attributes_generateTasksForSchedulesDateRangeStart_800d6f68feb01147ef0d2035",
"inputMode": "Each"
},
"attributeType": "Date"
},
{
"attributeCode": "attributes_computeDatesFromSchedulesDateRangeEnd_81c4dd81e998b56ddfe158ab",
"value": {
"parameterCode": "attributes_generateTasksForSchedulesDateRangeEnd_81c4dd81e998b56ddfe158ab",
"inputMode": "Each"
},
"attributeType": "Date"
}
],
"actions": [
{
"actionId": "8edfe7193b00ccf29a06cb98",
"designCode": "designs_workflowCloneItemAction",
"comments": "Clone the templated project",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowCloneItemActionsIgnoreReparentOnGraphCode",
"value": "Scheduling",
"attributeType": "String"
}
},
{
"attributeCode": "attributes_workflowCloneItemActionItem",
"value": {
"outputAction": "81176071c6ba35557a83acab",
"itemValue": {
"property": "ItemId"
},
"outputMode": "Input"
},
"attributeType": "Link"
}
],
"actions": []
},
{
"actionId": "80b1e0275695fa98d6c3f204",
"designCode": "designs_workflowOutputAction",
"comments": "For each date, add the tasks that should be generated on that date",
"parameters": [
{
"attributeCode": "attributes_workflowOutputActionData",
"value": {
"script": "Func<IEnumerable<AId>, IEnumerable<AId>> NullIfEmpty = input => input?.Any() == true ? input : null;\r\n\r\nJson(new \r\n{ \r\n items = Variables.datesForSchedule.AllValues.Select(x => new \r\n {\r\n attributes_generateTasksForSchedulesOutputDateOccurance_8ad5639456d15a25d67516c5 = x.Value.SingleValue, \r\n attributes_generateTasksForSchedulesOutputTasksToGenerate_88980c4bb0c09f070a251634 = taskTypes, \r\n attributes_generateTasksForSchedulesOutputOriginatingSchedule_8ad9c3629c895f9fba214d8c = schedule, \r\n attributes_generateTasksForSchedulesOutputParentProject_8bf67ac1853b59eab25cf283 = NullIfEmpty(clonedParentProject) ?? NullIfEmpty(parentProject) ?? Empty() \r\n }).ToArray()\r\n})"
},
"attributeType": "Json"
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionDodiCode",
"value": "designs_generateTasksForSchedulesOutput_83daf473e645176dfaff63dd",
"attributeType": "String"
}
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionSingleInstance",
"value": false
}
}
],
"variables": [
{
"name": "datesForSchedule",
"value": {
"inputParent": 0,
"itemValue": {
"attributeCode": "attributes_computeDatesFromSchedulesOutputDateOccurance_8ad5639456d15a25d67516c5"
}
},
"attributeType": "Date"
},
{
"name": "taskTypes",
"value": {
"inputParent": 1,
"itemValue": {
"attributeCode": "attributes_scheduleTasksToGenerate_8e052b8307c10ea8ae43b4ec"
}
},
"attributeType": "Link"
},
{
"name": "schedule",
"value": {
"inputParent": 1,
"itemValue": {
"property": "ItemId"
}
},
"attributeType": "Link"
},
{
"name": "parentProject",
"value": {
"inputParent": 1,
"itemValue": {
"attributeCode": "attributes_scheduleLiveOrTemplateProject_8e78cba487983ce05e5f0dc3"
}
},
"attributeType": "Link"
},
{
"name": "clonedParentProject",
"value": {
"outputAction": "8edfe7193b00ccf29a06cb98",
"outputMode": "Input",
"itemValue": {
"property": "ItemId"
}
},
"attributeType": "Link"
}
],
"actions": []
}
]
},
{
"actionId": "89878dbf508255d9a74c8a26",
"designCode": "designs_workflowRelationAction",
"comments": "Navigate to connected schedulables",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowRelationActionsAqsPath",
"value": "root^attributes_schedulableTaskSchedules_86d15a122f4aaa1b57cedbf4",
"attributeType": "String"
}
}
],
"actions": [
{
"actionId": "89878dbf70825579a74c8187",
"designCode": "designs_workflowRelationAction",
"comments": "Navigate to TaskAssignable",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowRelationActionsStandardPathId",
"value": "66f56ab51797b9a782228000",
"attributeType": "String"
}
}
],
"actions": [
{
"actionId": "8cfcf856875ba8d0c8d25780",
"designCode": "designs_workflowOutputAction",
"comments": "For each schedulable, output the set of dates it should be scheduled on with the task types",
"parameters": [
{
"attributeCode": "attributes_workflowOutputActionData",
"value": {
"script": "var allDates = Variables.datesForSchedulable.AllValues.Select(x=>x.Value.SingleValue).ToArray();\r\nvar allTypes = Variables.taskTypesForSchedulable.AllValues.Select(x=>x.Value.SingleValue).ToArray();\r\nvar allSchedules = Variables.scheduleForSchedulable.AllValues.Select(x=>x.Value.SingleValue).ToArray();\r\nvar allProjects = Variables.parentProjectForSchedulable.AllValues.Select(x=>x.Value.SingleValue).ToArray();\r\nvar datesAndTasks = Enumerable.Range(0, allDates.Length).Select(i => new object[] { allDates[i], allTypes[i], allSchedules[i], allProjects[i] }).ToArray();\r\n\r\nJson(new \r\n{ \r\n items = datesAndTasks.Select(x => new \r\n { \r\n attributes_generateTasksForSchedulesOutputDateOccurance_8ad5639456d15a25d67516c5 = x[0],\r\n attributes_generateTasksForSchedulesOutputTasksToGenerate_88980c4bb0c09f070a251634 = x[1],\r\n attributes_generateTasksForSchedulesOutputOriginatingSchedule_8ad9c3629c895f9fba214d8c = x[2],\r\n attributes_generateTasksForSchedulesOutputParentProject_8bf67ac1853b59eab25cf283 = x[3]\r\n }).ToArray() \r\n})"
},
"attributeType": "Json"
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionDodiCode",
"value": "designs_generateTasksForSchedulesOutput_83daf473e645176dfaff63dd",
"attributeType": "String"
}
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionSingleInstance",
"value": false
}
}
],
"variables": [
{
"name": "datesForSchedulable",
"value": {
"outputAction": "80b1e0275695fa98d6c3f204",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_generateTasksForSchedulesOutputDateOccurance_8ad5639456d15a25d67516c5"
}
},
"attributeType": "Date"
},
{
"name": "taskTypesForSchedulable",
"value": {
"outputAction": "80b1e0275695fa98d6c3f204",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_generateTasksForSchedulesOutputTasksToGenerate_88980c4bb0c09f070a251634"
}
},
"attributeType": "Link"
},
{
"name": "scheduleForSchedulable",
"value": {
"outputAction": "80b1e0275695fa98d6c3f204",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_generateTasksForSchedulesOutputOriginatingSchedule_8ad9c3629c895f9fba214d8c"
}
},
"attributeType": "Link"
},
{
"name": "parentProjectForSchedulable",
"value": {
"outputAction": "80b1e0275695fa98d6c3f204",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_generateTasksForSchedulesOutputParentProject_8bf67ac1853b59eab25cf283"
}
},
"attributeType": "Link"
}
],
"actions": [
{
"actionId": "8c05afd490f75f1e6cfec64b",
"designCode": "designs_pdMwrCloneTasks_88c2cae133b0a129e8d59af5",
"comments": "Clone from the task types",
"parameters": [
{
"attributeCode": "attributes_pdMwrCloneTasksTaskTypeMapping_82c4e2a3d30d521b74ddac7c",
"value": {
"inputParent": 0,
"itemValue": {
"attributeCode": "attributes_generateTasksForSchedulesOutputTasksToGenerate_88980c4bb0c09f070a251634"
}
},
"attributeType": "Link"
},
{
"attributeCode": "attributes_pdMwrCloneTasksParent_8a01f9693ca42ee2fa294d20",
"value": {
"inputParent": 1,
"itemValue": {
"property": "ItemId"
}
},
"attributeType": "Link"
},
{
"attribute": {
"attributeCode": "attributes_pdMwrCloneTasksParentAttributeCode_85c17f89d036dc16cfa6be82",
"value": "attributes_tasksAssignableTasks"
}
},
{
"attributeCode": "attributes_pdMwrCloneTasksTargetTimeMapping_8ac2665b87e9da36c0d2d86e",
"value": {
"inputParent": 0,
"itemValue": {
"attributeCode": "attributes_generateTasksForSchedulesOutputDateOccurance_8ad5639456d15a25d67516c5"
}
},
"attributeType": "Date"
},
{
"attributeCode": "attributes_pdMwrCloneTaskScheduleToleranceMapping_67d7fbb7fb1ac0695857260c",
"value": {
"inputParent": 3,
"itemValue": {
"attributeCode": "attributes_scheduleTolerance_67d7fb0ce3b13a41662d552d"
}
},
"attributeType": "Json"
}
],
"actions": [
{
"actionId": "8798b506314c6895a3473de8",
"designCode": "designs_workflowOutputAction",
"comments": "Navigate to any defined parent project",
"parameters": [
{
"attributeCode": "attributes_workflowOutputActionItems",
"value": {
"inputParent": 1,
"itemValue": {
"attributeCode": "attributes_generateTasksForSchedulesOutputParentProject_8bf67ac1853b59eab25cf283"
}
},
"attributeType": "Link"
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionDodiCode",
"value": "designInterfaces_projects",
"attributeType": "String"
}
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionSingleInstance",
"value": false
}
}
],
"actions": [
{
"actionId": "81f5d60761d819222a7be7be",
"designCode": "designs_workflowAddLinks",
"comments": "Seperately add to any parent project defined",
"parameters": [
{
"attributeCode": "attributes_workflowActionAddLinksItemsCode",
"value": {
"inputParent": 1,
"itemValue": {
"property": "ItemId"
}
},
"attributeType": "Link"
},
{
"attribute": {
"attributeCode": "attributes_workflowActionPatchLinkAttributeCode",
"value": "attributes_projectsTasks",
"attributeType": "String"
}
}
],
"variables": [],
"actions": []
}
]
},
{
"actionId": "86f5d9fbe54e9e0acd01d34d",
"designCode": "designs_workflowFilterAction",
"comments": "if it's a scheduled task....",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowFilterActionsAqsQuery",
"value": {
"type": "Query",
"properties": {
"dodiCode": "designInterfaces_scheduledTask_8465d419467667a08a6b03cf",
"collectionCode": "Live",
"attributes": [
"attributes_itemsTitle",
"attributes_itemsSubtitle"
]
}
},
"attributeType": "Aqs"
}
}
],
"variables": [],
"actions": [
{
"actionId": "88c28923f2091a05a2334cf5",
"designCode": "designs_workflowRelationAction",
"comments": "then navigate to the tasksAssignableWithNextDates (to eventually sync them)",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowRelationActionsAqsPath",
"value": "root^attributes_tasksAssignableTasks<designInterfaces_tasksAssignable>",
"attributeType": "String"
}
}
],
"variables": [],
"actions": [
{
"actionId": "88c28923f2091a01a2634ca6",
"designCode": "designs_workflowRelationAction",
"comments": "get the nextDates",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowRelationActionsAqsPath",
"value": "root.attributes_tasksAssignableWithNextDatesNextTargetDates_8273093477853f80782c1924",
"attributeType": "String"
}
}
],
"variables": [],
"actions": [
{
"actionId": "88c28923f2091a02a2434bb2",
"designCode": "designs_workflowFilterAction",
"comments": "filter to the ones meant for our taskType",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowFilterActionsAqsQuery",
"value": {
"type": "Query",
"properties": {
"dodiCode": "designs_nextTargetDate_8bbf2c5dac22df0ab9d7e055",
"collectionCode": "Live",
"parameters": [
{
"name": "matchingTaskType",
"type": "AlloyId"
}
],
"attributes": [
"attributes_itemsTitle",
"attributes_itemsSubtitle"
]
},
"children": [
{
"type": "Equals",
"children": [
{
"type": "Attribute",
"properties": {
"attributeCode": "attributes_nextTargetDateTaskType_86d15a1e2f4a2a1bf7cbabfa"
}
},
{
"type": "AlloyId",
"properties": {
"parameterName": "matchingTaskType"
}
}
]
}
]
},
"attributeType": "Aqs"
}
}
],
"variables": [
{
"name": "matchingTaskType",
"attributeType": "Link",
"value": {
"inputParent": 2,
"itemValue": {
"attributeCode": "attributes_tasksWithTaskTypesTaskType"
}
}
}
],
"actions": [
{
"actionId": "88ce8923f2091f05ae3ff2be",
"designCode": "designs_workflowDeleteItemAction",
"description": "Delete the dates",
"parameters": [],
"actions": []
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
},
{
"actionId": "681b1d59945307cbce072f8a",
"designCode": "designs_workflowFilterAction",
"description": "Get cyclical schedules",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowFilterActionsAqsQuery",
"value": {
"type": "Query",
"properties": {
"dodiCode": "designInterfaces_standardCyclicalSchedule_8df406ac30b303672ed6d907",
"collectionCode": "Live",
"attributes": [
"attributes_itemsTitle",
"attributes_itemsSubtitle"
]
}
},
"attributeType": "Aqs"
}
}
],
"variables": [],
"actions": []
},
{
"actionId": "681b1d59945307cbce072f8b",
"designCode": "designs_workflowFilterAction",
"description": "Get relative schedules",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowFilterActionsAqsQuery",
"value": {
"type": "Query",
"properties": {
"dodiCode": "designInterfaces_relativeDateSchedule_81e19cdae3c5d9df4917200e",
"collectionCode": "Live",
"attributes": [
"attributes_itemsTitle",
"attributes_itemsSubtitle"
]
}
},
"attributeType": "Aqs"
}
}
],
"variables": [],
"actions": []
},
{
"actionId": "8e5c5c8107dbff3d04e9e3ca",
"designCode": "designs_workflowOutputAction",
"comments": "Combine all periodicities from each schedule",
"parameters": [
{
"attributeCode": "attributes_workflowOutputActionItems",
"value": {
"script": "return isRelativeSchedule.Value ? (relativeInclusivePeriods ?? Empty()).Concat(relativeExclusivePeriods ?? Empty()).ToArray() : (cyclicalInclusivePeriods ?? Empty()).Concat(cyclicalExclusivePeriods ?? Empty()).ToArray();"
},
"attributeType": "Link"
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionDodiCode",
"attributeType": "String",
"value": {
"script": "return periodicityDodiCode;"
}
}
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionSingleInstance",
"value": false
}
}
],
"variables": [
{
"name": "cyclicalInclusivePeriods",
"attributeType": "Link",
"value": {
"outputAction": "681b1d59945307cbce072f8a",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_standardCyclicalScheduleInclusivePeriodicities_68132ec89b8145b312072f8a"
}
}
},
{
"name": "relativeInclusivePeriods",
"attributeType": "Link",
"value": {
"outputAction": "681b1d59945307cbce072f8b",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_relativeDateScheduleInclusivePeriodicities_68132ef2e1b1a16829072f8a"
}
}
},
{
"name": "cyclicalExclusivePeriods",
"attributeType": "Link",
"value": {
"outputAction": "681b1d59945307cbce072f8a",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_standardCyclicalScheduleExclusivePeriodicities_68132ec89b8145b312072f8b"
}
}
},
{
"name": "relativeExclusivePeriods",
"attributeType": "Link",
"value": {
"outputAction": "681b1d59945307cbce072f8b",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_relativeDateScheduleExclusivePeriodicities_68132ef2e1b1a16829072f8b"
}
}
},
{
"name": "onlyUsedToWaitForGeneration",
"value": {
"outputAction": "8c05afd490f75f1e6cfec64b",
"itemValue": {
"property": "ItemId"
}
},
"attributeType": "Link"
},
{
"name": "interfacesImplemented",
"value": {
"inputParent": 0,
"itemValue": {
"property": "Implements"
}
},
"attributeType": "String"
},
{
"name": "isRelativeSchedule",
"value": {
"script": "return Variables.interfacesImplemented.AllValues.Values.Any(x => x.SingleValue.Equals(\"designInterfaces_relativeDateSchedule_81e19cdae3c5d9df4917200e\"));"
},
"attributeType": "Boolean"
},
{
"name": "periodicityDodiCode",
"attributeType": "String",
"value": {
"script": "return isRelativeSchedule.Value ? \"designs_periodicityWithoutDateRange_68132f2da41c45eca2072f8a\" : \"designs_periodicity_8f3183380533b281ac719c10\";"
}
}
],
"actions": [
{
"actionId": "84e58355989cba75ae9d5cf2",
"designCode": "designs_computeDatesFromPeriodicities_874950917130ef4b6ae2e28c",
"comments": "Get periodicity's next date after these are all generated",
"parameters": [
{
"attributeCode": "attributes_computeDatesFromPeriodicitiesDateRangeStart_800d6f68feb01147ef0d2035",
"value": {
"parameterCode": "attributes_generateTasksForSchedulesDateRangeEnd_81c4dd81e998b56ddfe158ab",
"inputMode": "Each"
},
"attributeType": "Date"
},
{
"attribute": {
"attributeCode": "attributes_computeDatesFromPeriodicitiesLimit_8f4d17da8e3a79f4d3fa840b",
"value": 1
}
}
],
"actions": []
},
{
"actionId": "682356e9789fa82694c6efed",
"designCode": "designs_workflowOutputAction",
"comments": "Output interface",
"parameters": [
{
"attributeCode": "attributes_workflowOutputActionItems",
"value": {
"script": "return isRelativeSchedule.Value ? null : itemId;"
},
"attributeType": "Link"
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionDodiCode",
"value": "designs_periodicity_8f3183380533b281ac719c10"
}
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionSingleInstance",
"value": false
}
}
],
"variables": [
{
"name": "itemId",
"value": {
"inputParent": 0,
"itemValue": {
"property": "ItemId"
}
},
"attributeType": "Link"
},
{
"name": "designCode",
"value": {
"inputParent": 0,
"itemValue": {
"property": "DesignCode"
}
},
"attributeType": "String"
},
{
"name": "isRelativeSchedule",
"value": {
"script": "return Variables.designCode.SingleValue.Equals(\"designInterfaces_relativeDateSchedule_81e19cdae3c5d9df4917200e\");"
},
"attributeType": "Boolean"
}
],
"actions": [
{
"actionId": "863da0ba1c67a4896317a379",
"designCode": "designs_workflowEditItemAction",
"comments": "Set periodicity's next date",
"parameters": [
{
"attributeCode": "attributes_periodicityNextDate_8b766935838e7116fb62e7c0",
"value": {
"outputAction": "84e58355989cba75ae9d5cf2",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_computeDatesFromPeriodicitiesOutputDateOccurance_8ad5639456d15a25d67516c5"
}
},
"attributeType": "Date"
}
],
"actions": []
}
]
}
]
}
]
}