Inherit Attachments from Child to Parent
When Attachment is added to a Task, add it to Task's User Story

{
"pipeline": [
{
"type": "source:targetprocess:EntityChanged",
"entityTypes": [
"attachment"
],
"modifications": {
"created": true,
"deleted": false,
"updated": false
}
},
{
"type": "filter:Relational",
"or": [
{
"and": [
{
"target": {
"type": "field",
"name": "Name",
"target": {
"type": "field",
"name": "EntityType",
"target": {
"type": "field",
"name": "General",
"target": {
"type": "pipelineBlockOutput"
}
}
}
},
"value": {
"type": "constant",
"value": "Task"
},
"operator": {
"type": "is"
}
}
]
}
]
},
{
"type": "action:JavaScript",
"script": "const api = context.getService(\"targetprocess/api/v2\");\nconst usId = await api.getByIdAsync(\"Task\", args.Current.General.Id, {\n select: \"UserStory.id\"\n});\n\nreturn {\n command: \"targetprocess:CreateResource\",\n payload: {\n resourceType: \"Attachment\",\n fields: {\n Name: args.Current.Name,\n UniqueFileName: args.Current.UniqueFileName,\n Description: args.Current.Description,\n General: { id: usId }\n }\n }\n}"
}
]
}
Updated 11 months ago