The following checks to see if the budget holder is the same as the reporter if this is true the budget holder is then changed to the Emergency Budget Holder.
If change the else part of the statement to "EmergencyBudgetHolder" it works as a test, but I don't want to be case I want the IF part of the statement to work.. I am assuming its half way there..
JIRA 6.0.8 - Using JIRA Scripting Suite
Within a transition on a post function.
from com.atlassian.jira import ComponentManager
# Only perform functions on Travel Request issues
if(issue.getIssueTypeObject().getId()=="8") :
cm = ComponentManager.getInstance()
cfm = cm.getCustomFieldManager()
im = cm.getIssueManager()
accountCodeID = issue.getCustomFieldValue(cfm.getCustomFieldObject('customfield_10134'))
acIssue = im.getIssueObject(int(accountCodeID))
acBudgetHolder = acIssue.getCustomFieldValue(cfm.getCustomFieldObject('customfield_10070'))
acEmergencyBudgetHolder = acIssue.getCustomFieldValue(cfm.getCustomFieldObject('customfield_10151'))
cf=cfm.getCustomFieldObject('customfield_10070')
if issue.getReporter() == acBudgetHolder :
cf.getCustomFieldType().updateValue(cf,issue,acEmergencyBudgetHolder)
else :
cf.getCustomFieldType().updateValue(cf,issue,acBudgetHolder)