I am trying to create a post function that will update the priority field based on the value of a custom field. This is based on an example script from Atlassian Answers, I have included below for reference. needless to say it isn't working - but it doesn't fail which is a start!, so I am trying to add debug statements to see what is happening using "log.info", but I don't see this output anywhere. I have checked the atlassian.jira.log file and see no reference.
The execution information below says no logs.
Time (on server): Tue Apr 04 2017 11:06:37 GMT+0100 (GMT Daylight Time)
The following log information was produced by this execution. Use statements like:log.info("...") to record logging information.
No logs were found for this execution.
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.event.type.EventDispatchOption;
import com.atlassian.jira.event.issue.AbstractIssueEventListener;
import com.atlassian.jira.event.issue.IssueEvent;
import com.atlassian.jira.user.ApplicationUser;
import com.atlassian.jira.issue.UpdateIssueRequest;
import org.apache.log4j.Category;
class UpdateParentPriority extends AbstractIssueEventListener {
@Override // Fires on event Issue Updated
void workflowEvent(IssueEvent event) {
// Create Jira objects
MutableIssue mutableIssue = (MutableIssue)event.issue;
CustomFieldManager customFieldManager = ComponentAccessor.customFieldManager;
CustomField customField = customFieldManager.getCustomFieldObject("customfield_12248");
// Create adminUser user object
ApplicationUser adminUserAppUser = ComponentAccessor.getUserManager().getUserByKey("adminUser");
log.info("adminUserAppUser: " + adminUserAppUser);
// Incident Priority custom field value
def customFieldValue = mutableIssue.getCustomFieldValue(customField);
log.info("customFieldValue: " + customFieldValue);
// Set default priority based on Incident Priority
def majorPriorityID = "10000"; // Highest
def standardPriorityID = "5"; // High
switch (customFieldValue)
{ case "Audit (Internal)": mutableIssue.setPriorityId(majorPriorityID); log.info("Set priority to Highest"); break; case "Audit (External)": mutableIssue.setPriorityId(standardPriorityID); log.info("Set priority to Highest"); break; case "IT Problem Management": mutableIssue.setPriorityId(standardPriorityID); log.info("Set priority to High"); break; default: log.info("No need to change the priority"); break; }// Update issue as adminUser user
ComponentAccessor.getIssueManager().updateIssue(adminUserAppUser, mutableIssue, EventDispatchOption.DO_NOT_DISPATCH, false);
log.info("Script finished");
} // end workflowEvent()
} // end class UpdateParentPriority