Forums

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

automatically created task when specific task is present in a epic and epic status is change

Umar Maroof
Contributor
March 5, 2023

Hi hope everyone is doing well 

 I want to create a rule where I want to create a task when the epic status is change but the condition is there must be a specific task present inside the epic so it can create the new task otherwise it cant i.e

If the epic transit from in progress to ready to Pulish then if epic have the task name tasks for backend developers then it will create a new task backend publish task

 I construct the following rule but its not working Screenshot (21).png

2 answers

2 accepted

1 vote
Answer accepted
David Fischer
Community Champion
March 7, 2023

Hi @Umar Maroof ,

if you have JMWE, you can add a Create Issue(s) post function to your Epic transition (in the workflow editor), configure it to create the "Backend publishes task" (it should be fairly straightforward), check the "Run this post-function only if a condition is verified" option at the bottom of the screen and provide a "condition" like this:

{{ issue | stories("issuetype") | filter(["fields.issuetype.name","Tasks for backend developers"]) | length > 0}}

Let me know if you need more help. 

Umar Maroof
Contributor
March 7, 2023

@David Fischer I copy the same condition that you give me still its not workingScreenshot (23).png

David Fischer
Community Champion
March 7, 2023

Please note that the issue type name is case-sensitive. Can you check the exact issue type name of the issue that should be under the Epic being transitioned for the new issue to be created?

Umar Maroof
Contributor
March 7, 2023

@David Fischer  see the name is sameScreenshot (24).png

Umar Maroof
Contributor
March 7, 2023

@David Fischer this is the name of the tasks if this task is present under epic and epic transit to one status to another status the new issue should create...if I remove the condition its creating the issue but with condition nothing happening  

David Fischer
Community Champion
March 7, 2023

@Umar Maroof I just tested it and it works just fine for me. So just to be sure:

  • You have added the Create Issue(s) post function on the transition you are triggering on the Epic
  • You selected an Epic that already has, under "Issues in this epic", an issue of type "tasks for backend developers"
  • You triggered the transition on that Epic
  • In the JMWE Logs, you see a message saying "Condition returned false. Skipping execution"

If so, can you go to the Nunjucks and Jira Expression Tester page and "test" this expression against the Epic selected above?

{{ issue | stories("issuetype") | dump(2) }}

and post the result here?

Umar Maroof
Contributor
March 7, 2023

@David Fischer In the JMWE logs there is nothing 

Umar Maroof
Contributor
March 7, 2023

@David Fischer without putting the condition its works fine when i trigger the transition the new issue is created 

but with condition I want to create a new issue when the issue tasks for backend developers are present under epic but nothing happening. 

David Fischer
Community Champion
March 7, 2023

Can you follow my previous ask?

Also, if you don't see anything in the JMWE logs, it means JMWE is not doing anything, so I don't see how it could create a new issue. Are you sure it's not another automation that's creating the new issue?

Can you share your JMWE Create Issue(s) post function ID, as it appears on the configuration page?

Umar Maroof
Contributor
March 7, 2023

@David Fischer the one error that it is shown is for mistake thats not related to conditionScreenshot (26).png

David Fischer
Community Champion
March 7, 2023

If you click on "1 error", it'll take you to the JMWE Logs page and filter logs for that specific post function. Then modify the "Level" filter to "INFO" to "FATAL" and you'll see the post function executions and the "Condition returned false. Skipping execution" message.

Umar Maroof
Contributor
March 7, 2023

@David Fischer when I run the flollowing expression in Nunjucks tester it return as false.Screenshot (27).png

{{ issue | stories("issuetype") | filter(["fields.issuetype.name","Tasks for backend developers"]) | length > 0}}
David Fischer
Community Champion
March 8, 2023

Again, can you please run this in the tester:

{{ issue | stories("issuetype") | dump(2) }}
Umar Maroof
Contributor
March 8, 2023
ok
David Fischer
Community Champion
March 8, 2023

Thanks. That confirms my assumption: there is a trailing space in the Issue Type name: 

"Tasks for backend developers "

So you have two options:

  1. Rename the Issue Type and remove the trailing space (recommended)
  2. Update the script to take that space into account:
    {{ issue | stories("issuetype") | filter(["fields.issuetype.name","Tasks for backend developers "]) | length > 0}}
Umar Maroof
Contributor
March 8, 2023

@David Fischer Thank you so much for your help 

Umar Maroof
Contributor
March 8, 2023

@David Fischer 1 More thing like I want the newly created issue will be the child of that epic so when I set the field epic link as copy of current issue its not copying the epic link.

David Fischer
Community Champion
March 9, 2023

You need to set the Epic Link field to "Set to other field of current issue:" and select the "Key" field:

image.png

Like # people like this
0 votes
Answer accepted
Fabian Lim
Community Champion
March 5, 2023

Hi @Umar Maroof

Can you share a screenshot of your audit log to see what the error is?

Regards

Umar Maroof
Contributor
March 6, 2023
Fabian Lim
Community Champion
March 6, 2023

Hi @Umar Maroof

The rule doesn't work because you are looking for a parent for the epic which does not exist.  So that's why is empty.

You can try creating a branch to go under the tickets in the epic (https://support.atlassian.com/cloud-automation/docs/what-is-rule-branching/)

Then use a JQL condition to check whether the specific ticket type and summary exists, if it does, then you can create a new variable action that tells you that the ticket exists.

Branch out of the rule and then transition the epic and create a new task and link it. 

If you have the budget, I would spend the money on JMWE or JSU which have workflow functions pre-built for this. This action for Jira Automation becomes very messy.

Regards

Umar Maroof
Contributor
March 6, 2023

@Fabian Lim  I have JMWE, but I am not sure how to achieve this by JMWE.

Suggest an answer

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

Atlassian Community Events