Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Call a transition by rest endpoint


I wrote a script in 'REST Endpoint' and 'script fragments' that calls a transition by clicking a button.

The screen of this transition didn't pop-up but the transition itself happened.

I need this screen to shown before the transition, Can you know what is missing?


This is my script:


import groovy.transform.BaseScript
import groovy.transform.BaseScript
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.ComponentManager
import javax.servlet.http.HttpServletRequest;
import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.ServiceResultImpl
import com.atlassian.jira.bc.issue.IssueService.TransitionValidationResult
import com.atlassian.jira.issue.IssueInputParametersImpl
import com.atlassian.jira.issue.IssueInputParameters
import com.atlassian.jira.workflow.TransitionOptions
import static com.atlassian.jira.workflow.TransitionOptions.Builder;

@BaseScript CustomEndpointDelegate delegate

Deferred(httpMethod: "GET") {
MultivaluedMap queryParams,String body, HttpServletRequest request ->

String theUrltoReturn = ""
String issueId;
String clonedMessage;
try {

issueId = queryParams.getFirst("issueId") as String
IssueManager issueManager = ComponentAccessor.getIssueManager();
Issue issue = issueManager.getIssueObject(Long.parseLong(issueId));

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();

// def baseURL = ComponentAccessor.getApplicationProperties()getString(APKeys.JIRA_BASEURL)

//theUrltoReturn = request.getHeader("reffer");
//theUrltoReturn = baseURL+'/browse/'+issue
theUrltoReturn = request.getHeader("referer");
log.warn theUrltoReturn
catch (e) {
return Response.serverError().entity([error: e.message]).build();



void DeferredTransition(issueId) {
try {
Issue issue
if (isNumeric(issueId)){

issue =

issue =


IssueService issueService = ComponentAccessor.getIssueService()
int actionId = 241// Deferred
TransitionValidationResult transitionValidationResult
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

IssueInputParameters issueInputParameters = issueService.newIssueInputParameters();
TransitionOptions trasitionOptions = new Builder().skipPermissions().skipValidators().setAutomaticTransition().skipConditions().build();

transitionValidationResult = issueService.validateTransition(currentUser,, actionId, issueService.newIssueInputParameters(),trasitionOptions)

if (transitionValidationResult.isValid()) {
issueService.transition(currentUser, transitionValidationResult)
else {
log.warn("The transitionValidation is not valid")

} catch (Exception e) {

boolean isNumeric(String inputData) {
return inputData.matches("[-+]?\\d+(\\.\\d+)?");

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

Do you use Jira Cloud with Microsoft Teams?

Hi, Jira users! Do you use Jira alongside Microsoft Teams? We want to hear how you’ve used the power of Jira Cloud and Microsoft Teams (via the Jira Cloud for Microsoft Teams app) to achieve a team...

111 views 0 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you