Looking for some guidance as I'm stuck on my next steps...
My goal is to create a listener on a single project and when the "T-Shirt" custom field is set or modified (values are "S", "M", "L") we update the original estimate field with a corresponding value.
Small = 5d
Medium = 10d
Large = 15d
I've added a post function to test on new issue creation to set an original estimate, but still nothing is set (currently just testing the "M" size).
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.security.JiraAuthenticationContext
import com.atlassian.jira.ComponentManager
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def tshirt = customFieldManager.getCustomFieldObject(10142)
def tshirtsize = issue.getCustomFieldValue(tshirt)
if(tshirtsize =='M'){
MutableIssue issue=issue
issue.setEstimate ((long)288000)
IssueEvent event;
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
ComponentAccessor.getIssueManager().updateIssue(currentUser, issue, EventDispatchOption.ISSUE_UPDATED, false);
}
log.debug(tshirt);
log.debug(tshirtsize);
2019-12-10 00:18:42,530 DEBUG [workflow.ScriptWorkflowFunction]: T-Shirt
2019-12-10 00:18:42,530 DEBUG [workflow.ScriptWorkflowFunction]: M
Debug logs are showing the custom field and it's value correctly, so it's how I'm setting the original estimate field. Any help would be greatly appreciated.