Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Calculate field value

Deleted user June 27, 2014

Hi every one

My manager want me to have a custom field in JIRA for ranking issues. The value of this issue must have been calculated based on multiplication another 2 fields value.
Assume:
Complexity : High - Medium - Low values that we give them a rating from 3 to1.

Periority: Blocker - Critical - Major - Minor that we give them a rating from 4 to 1.


And a third field we called Rank that we want to get it's value from this formula:
Rank = Complexity * Priority

I didn't have any scripting exprience and I think it's nesesary for doing this. If it's nesessary please introduce some material for quick and easy learning of scrpting languages. :)

Cheers
Ansar

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Deleted user June 28, 2014
I try this code and it works fine. Thanks for your help.

def double rank = 12.0;
def complexity = getCustomFieldValue("Complexity");
if(complexity == null)
	return rank;

switch(complexity.value)
{
	case "High": 	       
		switch(issue.priorityObject.name)
		{
			case "Minor": 		rank = 12.0;	break;
        		case "Major": 		rank = 9.0;	break;
        		case "Critical": 	rank = 8.0;	break;
        		case "Blocker": 	rank = 6.0;	break;
        		default: 		rank = 12.0;	break;
		};
                break;
      	case "Medium": 
		switch(issue.priorityObject.name)
		{
			case "Minor": 		rank = 11.0;	break;
        		case "Major": 		rank = 7.0;	break;
        		case "Critical": 	rank = 5.0;	break;
        		case "Blocker": 	rank = 4.0;	break;
        		default: 		rank = 11.0;	break;
		};
                break;
      	case "Low":
		switch(issue.priorityObject.name)
		{
			case "Minor": 		rank = 10.0;	break;
        		case "Major": 		rank = 3.0;	break;
        		case "Critical": 	rank = 2.0;	break;
        		case "Blocker": 	rank = 1.0;	break;
        		default: 		rank = 10.0;	break;
		};
                break;
        default: 	rank = 12.0;
}

return rank;


					
				
			
			
			
				
			
			
			
			
			
			
		
0 votes
Timothy
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.
June 28, 2014
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 28, 2014

Also, I'd avoid calling the result "rank", because

a) Jira Agile uses that name

b) you're not really ranking issues - a rank usually determines the order in a list, and is unique (you can always say issue X outranks issue Y), whereas your formula allows X and Y to have the same value. It's something more like "urgency" or "weight"

TAGS
AUG Leaders

Atlassian Community Events