Hi everybody,
i wan to create a post-function that will will sum the values of two number custom fields. A third number field will take the value of the sum. I have made some tests using script runner where i sum the values the two fields for a certain issue but i don't know how to make it work for a workflow transition. The code i'm using in script runner is the following
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.Issue;
IssueManager issueManager = ComponentManager.getInstance().getIssueManager();
CustomFieldManager customFieldManager = ComponentManager.getInstance().getCustomFieldManager();
Issue issue = issueManager.getIssueObject( "RF-9944" );
CustomField customField_amdtl = customFieldManager.getCustomFieldObjectByName( "Amount Due to Losses" );
CustomField customField_amdtfr = customFieldManager.getCustomFieldObjectByName( "Amount Due to Full Refund" );
Object fam = issue.getCustomFieldValue( customField_amdtl ) + issue.getCustomFieldValue( customField_amdtfr );
Thanks in advance,
Kostas