Workflow Increase or de-crease field value parent issue?

Hi,

 

I would like to increase or de-crease a field value on the parent issue. When sub task transition workflow.

 

Could not find a script todo this we use JMWE and Script runner.

 

Many Thanks

Kevin

 

2 answers

This widget could not be displayed.

Hi Kevin,

I think your best bet would be to set up a workflow post-function. The post-function would work something like this:

  • An issue is transitioned through the workflow
  • Post-function checks to see if the issue type is "sub-task"
  • If the issue is a "sub-task", update the custom field value on the parent issue
  • Parent issue now has updated value

Does that sound correct?

Hi Joshua,

This is correct, it would increase the count on a custom field on the parent.

Also, if the sub-task is move in error, then the transitioned workflow decrease the count on the perant custom field.

Many Thanks

Kevin

Hi Joshua,

 

Can you offer any more help?

 

Many Thanks

Kevin

What help are you looking for? 

Hi Nic,

 

For ease of reporting I need to have a couple of fields on my parent issue. 

The number of sub-tasks of x type

The number of sub-tasks of x type that are completed

I need setup a listener for this can you point me at a script to-do this.

Many thanks just learn JIRA

Kevin

Kevin Seery 3 seconds ago

Hi Nic,

Found these scripts

This one give me the count I wanted: 

issue.getSubTaskObjects().findAll {
it.getIssueTypeObject()?.getName() == "Project Capitalisation"
}.size()

 

Trying to change this one give me a count of issue type and status:


int numSubtasks = issue.getSubTaskObjects()?.size()?:0
if (numSubtasks>0) {
int numClosedSubtasks = issue.getSubTaskObjects()?.getName() == "Project Capitalisation".count{it?.statusObject?.name=='Closed'}?:0
return (numClosedSubtasks/numSubtasks) as Double
} else {
return 0 as Double
}

 

Do you have any pointers?

Many Thanks

Kevin

This widget could not be displayed.

Hi Nic,

Found these scripts

This one give me the count I wanted: 

issue.getSubTaskObjects().findAll {
it.getIssueTypeObject()?.getName() == "Project Capitalisation"
}.size()

 

Trying to change this one give me a count of issue type and status:


int numSubtasks = issue.getSubTaskObjects()?.size()?:0
if (numSubtasks>0) {
int numClosedSubtasks = issue.getSubTaskObjects()?.getName() == "Project Capitalisation".count{it?.statusObject?.name=='Closed'}?:0
return (numClosedSubtasks/numSubtasks) as Double
} else {
return 0 as Double
}

 

Do you have any pointers?

Many Thanks

Kevin

Hi,

Can anyone offer any help?

 

Thanks

Kevin

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

182 views 2 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you