I am trying to decrement a number field. I am trying to use the following script to do so as a post function. However, the number is not decrementing. What am I doing wrong?
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; com.atlassian.jira.issue.MutableIssue; // gets a reference to the IssueManager and CustomFieldManager manager classes IssueManager issueManager = ComponentManager.getInstance().getIssueManager(); CustomFieldManager customFieldManager = ComponentManager.getInstance().getCustomFieldManager(); // gets a reference to the desired issue and custom field CustomField customField_count1 = customFieldManager.getCustomFieldObjectByName( "Number of Code Defects" ); CustomField customField_count2 = customFieldManager.getCustomFieldObjectByName( "Number of Requirement Defects" ); // retrieves the custom field value object from the issue Object count1 = issue.getCustomFieldValue( customField_count1 ) - 1; Object count2 = issue.getCustomFieldValue( customField_count2 ) - 1; issue.setCustomFieldValue(customField_count1, count1); issue.setCustomFieldValue(customField_count2, count2);
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG