Forums

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

Need help editing scripted field to include additional issue types

Deleted user June 6, 2018

I have the following script in place and running, however after it was created our processes changed a bit and I'm not sure how to account for those changes. 

Currently the script looks at the "expense" field in all of the line item request issues and sums them up in a "Total Order Expense($)" field in the order request issue. 

Now I need that "Total Order Expense($) field in the order request to include the "Total Order Expense($) in the change order request issue type. 

I also need  it to subtract the "Returned Amount" in the RMA issue type from the "Total Order Expense($) in the Order request issue. 

I'm completely stumped and could really use some help. 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue

def csExpense = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Expense")
return issue.getSubTaskObjects().sum{it ->((Issue) it).getCustomFieldValue(csExpense)};

 

1 answer

0 votes
Ivan Tovbin
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 7, 2018

Hi Scott,

I might be able to help you out here. But first could you give me the list of all involved fields and their field types. Also I'd like to know, all these different issue types, how exacly are they related to each other (issue links or subtasks, etc).

Deleted user June 7, 2018

Hey @Ivan Tovbin, thank you. 

So here is how they break down. 

total order expense.PNG

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events