scriptrunner-public-sorin /src/test/resources/examples/justinc.groovy

Language Groovy Lines 18
MD5 Hash c746c1d3a6962e0c22cfd6bab21ab5c9
Repository https://bitbucket.org/sorin/scriptrunner-public-sorin View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
import com.atlassian.jira.ManagerFactory
import com.atlassian.jira.event.issue.IssueEventDispatcher
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.comments.Comment
import org.apache.log4j.Category
import org.ofbiz.core.entity.GenericValue
import com.atlassian.jira.event.issue.IssueEventSource

log = Category.getInstance("com.onresolve.jira.groovy.example.SendEmailOnBlocker")

if (issue.getPriorityObject().getName().equals("Blocker")) {   // check if the priority is Blocker, change this line for other criteria
    Issue updatedIssue = (Issue) transientVars.get("issue");
    Comment comment = (Comment)transientVars.get("commentValue");
    GenericValue changeGroup = (GenericValue) transientVars.get("changeGroup");
    Map params = new HashMap(4);
    params.put("eventsource", IssueEventSource.WORKFLOW);
    IssueEventDispatcher.dispatchEvent(10000, updatedIssue, ManagerFactory.getWorkflowManager().getRemoteUser(transientVars), comment, null, changeGroup, params, true);
}
Back to Top