Hi all,
I'm trying to write a simple script to update original estimate / remaining time on an issue based on a custom field value (nothing too fancy):
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.MutableIssue;
def myFieldId = "customfield_11800"
def myCustomFieldManager = ComponentAccessor.getCustomFieldManager()
def myCustomField = myCustomFieldManager.getCustomFieldObject(myFieldId);
def myIssueManager = ComponentAccessor.getIssueManager();
def myWorkload = issue.getCustomFieldValue(myCustomField).toLong()*60*60*8;
// Update Issue
def myIssue = myIssueManager.getIssueObject(issue.getKey());
myIssue.setOriginalEstimate(myWorkload);
myIssue.setEstimate (myWorkload);
myIssue.store();
I've copied my script to my Jira home (/opt/atlassian/jira) to try it and created a post-fuction to run the script.
On a sandbox project I tried to make it works without success and strangely the catalina.out remain silent (no error).
What have I missed?
Thank you for your help!