Hello -
In my Jira project I am attempting to configure a Script Field that involves some basic math. There are 2 custom fields that are involved: "Amount Requested" and "Amount Returned." The Script Field is called "Amount Available."
What I want to happen is for the Script Field (Amount Available) to continuously calculate:
(Amount Returned) - (Amount Requested) = Available Amount
I currently have this script:
import com.atlassian.jira.component.ComponentAccessor
def aval = getCustomFieldValue("Amount Requested")
def bval = getCustomFieldValue("Amount Returned")
return bval - aval
So far it seems like this script is calculating the correct math. There is one step that I want to add to take this further though. Is there a way for me to set the Amount Available field to 1000, and then continue with the scripted equation?
In short, what I am ultimately attempting to achieve is:
1000 + (Amount Returned) - (Amount Requested) = Available Amount
I am at a loss as to what I can do here (if anything). Would appreciate any help I can get. Thanks.