Forums

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

Create Jira Automation to calculate WSJF (custom field)

Karin Biedermann
Contributor
July 20, 2023

Dear community

I have a question regarding Jira Automation for Jira Data Center. 

Current Situation 

In order to prioritize Epics we use Weighted Shortest Job First (WSJF). Until now we calculated it this way: 

  • We have 4 custom fields "Business Value", "Time Criticality", "Risk or Opportunity" and "Story Points".  
  • I added a post function to the Epic Workflow that the 5th field "WSJF" is calculated using the formula (Business Value + Time Criticality + Risk or Opportunity) / Story Points.

In this situation we always need to manually transition to a certain status in order to run the groovy script. 

wsjf = (issue.get("customfield_10005") // Business Value
+ issue.get("customfield_14804") // Time Criticality
+ issue.get("customfield_14805") // Riks or Opportunity
) / issue.get("customfield_10004") // Story Points

issue.setFieldValue("customfield_14806", wsjf)
issue.setFieldValue("Resolution", null)

Expectation

As this manual step is annoying and sometimes takes a lot of time I wanted to add an automation to our project so that every time one of the 4 custom fields value has been changed, the 5th field "WSJF" is automatically updated. 

I tried doing it by changing the groovy script to a json object and add it to the action "Edit issue" but it does not work. 

Any proposals how you would solve that? 

Thanks a lot!

 

2 answers

1 accepted

0 votes
Answer accepted
Kseniia Trushnikova
Community Champion
July 20, 2023

Hello @Karin Biedermann,

Create a rule with the trigger Field value changed and the action Edit issue. Add the following line for calculating the field WSJF:

{{issue.customfield_10004|0}} + {{issue.customfield_10005|0}} + {{issue.customfield_14804|0}} + {{issue.customfield_14805|0}}

By adding "|0", you specify the default value if a field is empty. Here's the example:

Rule Example.png

Karin Biedermann
Contributor
July 24, 2023

HI @Kseniia Trushnikova 

This worked. Thank you!

0 votes
Karin Biedermann
Contributor
July 20, 2023

Hi @Kseniia Trushnikova 

Thank you for your fast response. 
Unfortunately it does not work in my case.

I get the following error message

wsjf.jpg

But I checked again. The issue ID for risk or opportunity is correct. 

Would you know if I missed something?

Kseniia Trushnikova
Community Champion
July 20, 2023

Try this:

({{issue.customfield_10005|0}} + {{issue.customfield_14804|0}} + {{issue.customfield_14805|0}}) / {{issue.customfield_10004|0}}

Suggest an answer

Log in or Sign up to answer