Forums

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

Assign asignee from last comment

Marcel Huisman April 5, 2024

Sometimes we have repetitive tasks which needs to be assigned to different assignees.

I created an automation to read the last comment and create Stories from this.

For example, last comment is:

Server1
Server2
Server3

By triggering a manual automation from the Epic, it will create Stories and subtasks.

For example:

EPIC: Decommission Servers 2024 Q2
    Story: Decommission Server1
        Subtask: Task1
        Subtask: Task2
    Story: Decommission Server2
        Subtask: Task1
        Subtask: Task2
    Story: Decommission Server3
        Subtask: Task1
        Subtask: Task2

So far so good.
Now I like to change the comment to:
Server1-John Doe
Server2-Don Johnson
Server3-David Hasselhoff

So I like to read each line, already working with {{issue.comments.last.body.split("\n")}} and split the server name and username. The user name should be the Assignee for the story and subtasks at the end of the automation.

First creating a variable Servername from {{issue.comments.last.body.split("\n")}}

This works for the name of the Story:

Decommission {{Servername.split("-").get(0)}}
It creates Stories with subtasks with the correct name.


I can't seem to get it to work for the assignee, the other part of the splitted variable. I tried the advance options to add the name to the assignee filend, but this doesn't work:

{
"fields": {
"assignee": { "id": "{{Servername.split('-').last}}" }
}


Any idea what I am missing?

2 answers

0 votes
Marcel Huisman April 5, 2024

Thanks for your answer @Dex Unfortunately the Story and Subtasks are still unassigned...

0 votes
Dexter de Vera
Community Champion
April 5, 2024

Hi @Marcel Huisman ,

Maybe you can try the name instead. Just make sure the name is exactly same indicated in user.

 {

   "fields": {

        "assignee": { "name": "{{Servername.split('-').last}}" }

    }

}

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events