Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Creating child tasks while copying files based on certain naming

Alexandra Peia July 22, 2024

Hello!

 

I would like to create an automation rule so as, when moving a task to "in progress", to create child tasks.

The trick is that I want to add a number of files to the parent task and I would like for each of the child tasks to automatically copy one of the attachments in the parent. Ideally, I would like for the child task names to also inherit the file name of the file it inherits from the parent. Hope this makes sense.

Also, can the number of child tasks be the same as the number of attachments but I can also stick to a predefined number if this is not possible.

Can this be done? Thank you so much!

2 answers

2 accepted

0 votes
Answer accepted
Tessa Tuteleers
Community Champion
July 22, 2024

Hi @Alexandra Peia , 

Welcome to the community! 

 

If I understand correct you would like to do the following: 

  • When you transition a parent issue with attachments
    • Create a subtask for each attachment: 
      • Summary = name of the attachment
      • Attachment itself is copied to the subtask

Is this correct? 

This can certainly be done, but with some workarounds:

  1. You can branch over the different attachments using the {{attachment}} smart value. 
    This wil return the attachment or a list of attachements if there are more. 
  2. In you branch you can create an issue and target the attachment name using {{file.fileName}} and the download url uisng {{file.content}}.

You would use the URL of the attachment to refer to it in the subtask, as sadly it is not possible to copy a specific attachment to the new issue. (You could copy the attachments themselves, but in that case you always copy ALL attachments). 

Doc of attachment smart value here.
You can find a similar question here

It would look something like this: 
Screenshot 2024-07-22 114020.pngScreenshot 2024-07-22 114027.png

Please let me know if you have furter questions! 

- Tessa

Alexandra Peia July 23, 2024

Thank you so much, it works great! 

One more detail: can I remove part pf the file name? Let's say all my file names will be something likeL "[B]Cats and dogs.docx" and I would like the task name to only have "Cats and dogs"? Also, can I add anything to the name, a specific word? It's not mandatory but it would help a lot!

Dommalapati Chandrababu Naidu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 23, 2024

Hi @Alexandra Peia

You can provide filename as you desired in the summary of create issue action. 

 Capture.PNG

i am not sure about the splitting the file name.

Hope this helps!.

 

Chandrababu 

Tessa Tuteleers
Community Champion
July 24, 2024

Hi @Alexandra Peia , 

it is possible to manipulate text, you can find information about it here

 

you would need to get all text before the last "." and it would look something like this then: 

{{file.fileName.substringBeforeLast(".")}} 

 

There are a lot of fun ways to play around with smaert values, and there is a lot of documentation and examples available, I invite you to look and play around with it if you have to do these sort of manipulations more often :) 

You can also drop [B] this way is you want and stuff like that. Adding a fixed word to the summary is just by adding the plain text before or after the smart value ;) 

Have a great day and if this helped you, please accept my original answer so people can find the solution quicker. 

- Tessa 

Alexandra Peia July 24, 2024

Thank you so much!

0 votes
Answer accepted
Dommalapati Chandrababu Naidu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 22, 2024

Hi Alexandra, 

Welcome to Atlassian community. 

Kindly follow below link.  Mr. Esteban has mentioned the flow in his answer. 

https://community.atlassian.com/t5/Jira-Service-Management/Re-Jira-Automation-Create-Subtasks-for-each-attachment/qaq-p/2455777/comment-id/145416#M145416

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events