Forums

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

How to create a subtask when in a task it add a flag?

Jose Luna López April 24, 2019 edited

I would like to add a subtask automatically when I add a flag on a issue. 

 

 

We had the plugin ScriptRunner.

3 answers

0 votes
larry.lowe
Contributor
May 19, 2020

@Jose_Luna_López

  1. I used scriptrunner to create a new listener
  2. Choose the option to create a sub-task from the listener templates
  3. Select "Issue Updated" as the event
  4. Enter the below code for the "Condition":
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder

def change = event?.getChangeLog()?.getRelated("ChildChangeItem").find {it.field == "Flagged"}
if (change && ('Impediment' in cfValues['Flagged']*.value)){
return true;
}

 I was able to get this working in Jira Data Center 7.13

0 votes
Larry Lowe May 19, 2020 edited

 

 

0 votes
Nic Brough -Adaptavist-
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.
April 26, 2019

I am not sure this is possible - if adding a flag fires an event, then you can write a listener to catch the event and create a subtask, but I have a feeling no event is fired by flagging or un-flagging.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events