Start the parent item when a child item has been started
Start a User Story when its Task has been started
[
{
"type": "source:targetprocess:EntityChanged",
"entityTypes": [
"Task"
],
"modifications": {
"created": false,
"deleted": false,
"updated": [
"StartDate"
]
}
},
{
"or": [
{
"and": [
{
"target": {
"type": "field",
"name": "StartDate",
"target": {
"type": "field",
"name": "UserStory",
"target": {
"type": "pipelineBlockOutput"
}
}
},
"value": {
"type": "constant",
"value": null
},
"operator": {
"type": "not exists"
}
},
{
"target": {
"type": "field",
"name": "StartDate",
"target": {
"type": "field",
"name": "Previous",
"target": {
"type": "pipelineBlockOutput"
}
}
},
"value": {
"type": "constant",
"value": null
},
"operator": {
"type": "not exists"
}
},
{
"target": {
"type": "field",
"name": "StartDate",
"target": {
"type": "pipelineBlockOutput"
}
},
"value": {
"type": "constant",
"value": null
},
"operator": {
"type": "exists"
}
}
]
}
],
"type": "filter:Relational"
},
{
"type": "action:JavaScript",
"script": "const parentType = \"UserStory\";\nconst parentId = args.Current.UserStory.Id;\n\nconst api = context.getService(\"targetprocess/api/v2\");\nconst processes = await api.queryAsync(\"processes\", {\n select: `{states:entitystates.where(entitytype.name=\"${parentType}\").orderby(numericPriority).select(id),`\n + `planned:entitystates.where(entitytype.name=\"${parentType}\" and isplanned=true).first().id}`,\n where: `projects.count(id=${args.Current.Project.Id})>0`\n});\n\nconst states = processes[0].states;\nconst planned = processes[0].planned;\nconst targetState = planned ? states[states.indexOf(planned) + 1] : states[1];\n\nreturn {\n command: \"targetprocess:UpdateResource\",\n payload: {\n resourceType: parentType,\n resourceId: parentId,\n fields: {\n EntityState: { ID: targetState}\n }\n }\n};"
}
]
Start a Feature when its User Story has been started
[
{
"type": "source:targetprocess:EntityChanged",
"entityTypes": [
"UserStory"
],
"modifications": {
"created": false,
"deleted": false,
"updated": [
"StartDate"
]
}
},
{
"or": [
{
"and": [
{
"target": {
"type": "field",
"name": "StartDate",
"target": {
"type": "field",
"name": "Feature",
"target": {
"type": "pipelineBlockOutput"
}
}
},
"value": {
"type": "constant",
"value": null
},
"operator": {
"type": "not exists"
}
},
{
"target": {
"type": "field",
"name": "StartDate",
"target": {
"type": "field",
"name": "Previous",
"target": {
"type": "pipelineBlockOutput"
}
}
},
"value": {
"type": "constant",
"value": null
},
"operator": {
"type": "not exists"
}
},
{
"target": {
"type": "field",
"name": "StartDate",
"target": {
"type": "pipelineBlockOutput"
}
},
"value": {
"type": "constant",
"value": null
},
"operator": {
"type": "exists"
}
},
{
"target": {
"type": "field",
"name": "Feature",
"target": {
"type": "pipelineBlockOutput"
}
},
"value": null,
"operator": {
"type": "exists"
}
}
]
}
],
"type": "filter:Relational"
},
{
"type": "action:JavaScript",
"script": "const parentType = \"Feature\";\nconst parentId = args.Current[parentType].Id;\n\nconst api = context.getService(\"targetprocess/api/v2\");\nconst processes = await api.queryAsync(\"processes\", {\n select: `{states:entitystates.where(entitytype.name=\"${parentType}\").orderby(numericPriority).select(id),`\n + `planned:entitystates.where(entitytype.name=\"${parentType}\" and isplanned=true).first().id}`,\n where: `projects.count(id=${args.Current.Project.Id})>0`\n});\n\nconst states = processes[0].states;\nconst planned = processes[0].planned;\nconst targetState = planned ? states[states.indexOf(planned) + 1] : states[1];\n\nreturn {\n command: \"targetprocess:UpdateResource\",\n payload: {\n resourceType: parentType,\n resourceId: parentId,\n fields: {\n EntityState: { ID: targetState}\n }\n }\n};"
}
]
Start an Epic when its Feature was started
[
{
"type": "source:targetprocess:EntityChanged",
"entityTypes": [
"Feature"
],
"modifications": {
"created": false,
"deleted": false,
"updated": [
"StartDate"
]
}
},
{
"or": [
{
"and": [
{
"target": {
"type": "field",
"name": "StartDate",
"target": {
"type": "field",
"name": "Epic",
"target": {
"type": "pipelineBlockOutput"
}
}
},
"value": {
"type": "constant",
"value": null
},
"operator": {
"type": "not exists"
}
},
{
"target": {
"type": "field",
"name": "StartDate",
"target": {
"type": "field",
"name": "Previous",
"target": {
"type": "pipelineBlockOutput"
}
}
},
"value": {
"type": "constant",
"value": null
},
"operator": {
"type": "not exists"
}
},
{
"target": {
"type": "field",
"name": "StartDate",
"target": {
"type": "pipelineBlockOutput"
}
},
"value": {
"type": "constant",
"value": null
},
"operator": {
"type": "exists"
}
},
{
"target": {
"type": "field",
"name": "Epic",
"target": {
"type": "pipelineBlockOutput"
}
},
"value": null,
"operator": {
"type": "exists"
}
}
]
}
],
"type": "filter:Relational"
},
{
"type": "action:JavaScript",
"script": "const parentType = \"Epic\";\nconst parentId = args.Current[parentType].Id;\n\nconst api = context.getService(\"targetprocess/api/v2\");\nconst processes = await api.queryAsync(\"processes\", {\n select: `{states:entitystates.where(entitytype.name=\"${parentType}\").orderby(numericPriority).select(id),`\n + `planned:entitystates.where(entitytype.name=\"${parentType}\" and isplanned=true).first().id}`,\n where: `projects.count(id=${args.Current.Project.Id})>0`\n});\n\nconst states = processes[0].states;\nconst planned = processes[0].planned;\nconst targetState = planned ? states[states.indexOf(planned) + 1] : states[1];\n\nreturn {\n command: \"targetprocess:UpdateResource\",\n payload: {\n resourceType: parentType,\n resourceId: parentId,\n fields: {\n EntityState: { ID: targetState}\n }\n }\n};"
}
]
Start a Portfolio Epic when its Epic was started
[
{
"type": "source:targetprocess:EntityChanged",
"entityTypes": [
"Epic"
],
"modifications": {
"created": false,
"deleted": false,
"updated": [
"StartDate"
]
}
},
{
"or": [
{
"and": [
{
"target": {
"type": "field",
"name": "StartDate",
"target": {
"type": "field",
"name": "PortfolioEpic",
"target": {
"type": "pipelineBlockOutput"
}
}
},
"value": {
"type": "constant",
"value": null
},
"operator": {
"type": "not exists"
}
},
{
"target": {
"type": "field",
"name": "StartDate",
"target": {
"type": "field",
"name": "Previous",
"target": {
"type": "pipelineBlockOutput"
}
}
},
"value": {
"type": "constant",
"value": null
},
"operator": {
"type": "not exists"
}
},
{
"target": {
"type": "field",
"name": "StartDate",
"target": {
"type": "pipelineBlockOutput"
}
},
"value": {
"type": "constant",
"value": null
},
"operator": {
"type": "exists"
}
},
{
"target": {
"type": "field",
"name": "PortfolioEpic",
"target": {
"type": "pipelineBlockOutput"
}
},
"value": null,
"operator": {
"type": "exists"
}
}
]
}
],
"type": "filter:Relational"
},
{
"type": "action:JavaScript",
"script": "const parentType = \"PortfolioEpic\";\nconst parentId = args.Current[parentType].Id;\n\nconst api = context.getService(\"targetprocess/api/v2\");\nconst processes = await api.queryAsync(\"processes\", {\n select: `{states:entitystates.where(entitytype.name=\"${parentType}\").orderby(numericPriority).select(id),`\n + `planned:entitystates.where(entitytype.name=\"${parentType}\" and isplanned=true).first().id}`,\n where: `projects.count(id=${args.Current.Project.Id})>0`\n});\n\nconst states = processes[0].states;\nconst planned = processes[0].planned;\nconst targetState = planned ? states[states.indexOf(planned) + 1] : states[1];\n\nreturn {\n command: \"targetprocess:UpdateResource\",\n payload: {\n resourceType: parentType,\n resourceId: parentId,\n fields: {\n EntityState: { ID: targetState}\n }\n }\n};"
}
]
Start a Project when its User Story was started
[
{
"type": "source:targetprocess:EntityChanged",
"entityTypes": [
"UserStory"
],
"modifications": {
"created": false,
"deleted": false,
"updated": [
"StartDate"
]
}
},
{
"or": [
{
"and": [
{
"value": {
"type": "constant",
"value": null
},
"target": {
"name": "StartDate",
"type": "field",
"target": {
"name": "Project",
"type": "field",
"target": {
"type": "pipelineBlockOutput"
}
}
},
"operator": {
"type": "not exists"
}
},
{
"value": {
"type": "constant",
"value": null
},
"target": {
"name": "StartDate",
"type": "field",
"target": {
"name": "Previous",
"type": "field",
"target": {
"type": "pipelineBlockOutput"
}
}
},
"operator": {
"type": "not exists"
}
},
{
"value": {
"type": "constant",
"value": null
},
"target": {
"name": "StartDate",
"type": "field",
"target": {
"type": "pipelineBlockOutput"
}
},
"operator": {
"type": "exists"
}
}
]
}
],
"type": "filter:Relational"
},
{
"type": "action:JavaScript",
"script": "const parentType = \"Project\";\nconst projectId = args.Current.Project.Id;\n\nconst api = context.getService(\"targetprocess/api/v2\");\nconst processes = await api.queryAsync(\"processes\", {\n select: `{states:entitystates.where(entitytype.name=\"${parentType}\").orderby(numericPriority).select(id),`\n + `planned:entitystates.where(entitytype.name=\"${parentType}\" and isplanned=true).first().id}`,\n where: `projects.count(id=${projectId})>0`\n});\n\nconst states = processes[0].states;\nconst planned = processes[0].planned;\nconst targetState = planned ? states[states.indexOf(planned) + 1] : states[1];\n\nreturn {\n command: \"targetprocess:UpdateResource\",\n payload: {\n resourceType: parentType,\n resourceId: projectId,\n fields: {\n EntityState: { ID: targetState}\n }\n }\n};"
}
]
Updated over 5 years ago