This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
def doTransition(issue, int actionId, user){ | |
def issueService = ComponentAccessor.getIssueService() | |
def issueInputParameters = issueService.newIssueInputParameters(); | |
def transitionValidationResult = issueService.validateTransition(user, issue.id, actionId, issueInputParameters); | |
if (transitionValidationResult.isValid()){ | |
issueService.transition(user, transitionValidationResult); | |
return true | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
import com.atlassian.jira.ofbiz.OfBizDelegator | |
import groovy.sql.GroovyRowResult | |
import groovy.sql.Sql | |
import org.ofbiz.core.entity.ConnectionFactory | |
import org.ofbiz.core.entity.DelegatorInterface | |
import java.sql.Connection | |
select("select ...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
import com.atlassian.mail.Email | |
def sendEmail(String emailAddr, String subject, String body) { | |
def mailServer = ComponentAccessor.getMailServerManager().getDefaultSMTPMailServer() | |
if (mailServer) { | |
email = new Email(emailAddr) | |
email.setSubject(subject) | |
email.setBody(body) | |
email.setMimeType("text/html; charset=utf-8") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.json.JsonBuilder | |
import groovy.transform.BaseScript | |
import com.atlassian.jira.component.ComponentAccessor | |
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder; | |
import com.atlassian.jira.issue.ModifiedValue; | |
import com.atlassian.jira.event.type.EventDispatchOption | |
import javax.ws.rs.core.MultivaluedMap | |
import javax.ws.rs.core.Response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
import groovy.json.JsonSlurper | |
cfStep = ComponentAccessor.customFieldManager.getCustomFieldObject(10003)//Text Field (single line) | |
cfCustomSelect = ComponentAccessor.customFieldManager.getCustomFieldObject(10004)//Custom Select List | |
def customSelectValue = issue.getCustomFieldValue(cfCustomSelect) | |
if(!customSelectValue){ | |
return false | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
import groovy.json.JsonSlurper | |
cfNeedApproval = ComponentAccessor.customFieldManager.getCustomFieldObject(10001)//User Picker (multiple users) | |
cfApprovedBy = ComponentAccessor.customFieldManager.getCustomFieldObject(10002)//User Picker (multiple users) | |
cfStep = ComponentAccessor.customFieldManager.getCustomFieldObject(10003)//Text Field (single line) | |
cfCustomSelect = ComponentAccessor.customFieldManager.getCustomFieldObject(10004)//Custom Select List https://marketplace.atlassian.com/apps/1218105/custom-select-list | |
def customSelectValue = issue.getCustomFieldValue(cfCustomSelect) | |
/*get data from custom select option: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
cfNeedApproval = ComponentAccessor.customFieldManager.getCustomFieldObject(10001)//User Picker (multiple users) | |
return (issue.getCustomFieldValue(cfNeedApproval)?:[]).contains(currentUser) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
import groovy.json.JsonSlurper | |
cfStep = ComponentAccessor.customFieldManager.getCustomFieldObject(10003)//Text Field (single line) | |
cfCustomSelect = ComponentAccessor.customFieldManager.getCustomFieldObject(10004)//Custom Select List | |
def customSelectValue = issue.getCustomFieldValue(cfCustomSelect) | |
def processApproval = parseText(customSelectValue.getData()) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
cfNeedApproval = ComponentAccessor.customFieldManager.getCustomFieldObject(10001)//User Picker (multiple users) | |
cfApprovedBy = ComponentAccessor.customFieldManager.getCustomFieldObject(10002)//User Picker (multiple users) | |
cfStep = ComponentAccessor.customFieldManager.getCustomFieldObject(10003)//Text Field (single line) | |
issue.setCustomFieldValue(cfNeedApproval, null) | |
issue.setCustomFieldValue(cfApprovedBy, null) | |
issue.setCustomFieldValue(cfStep, null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
import com.opensymphony.workflow.InvalidInputException | |
def CUSTOM_FIELD_ID = 14910L | |
def MESSAGE_ERROR = "Field ${getCustomFieldObject(CUSTOM_FIELD_ID)} is required" | |
if(!getCustomFieldValue(issue, CUSTOM_FIELD_ID)){ | |
throw new InvalidInputException(MESSAGE_ERROR) | |
} |
OlderNewer