Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Automated issue status change using ScriptRunner Services


I need to automatically transition an issue to another status when a datetime custom field reaches current time. How could I implement this using Adaptavist ScriptRunner plugin?

1 answer

You might find helpful when looking to write scripts for transitions on issues.

But Listeners require a special event to occur to act. I dont have any events going on, the issue might not change at all. I want it to transition when the time's right. Is this possible when using Listeners?

No, listeners need an event.

But you could easily write a service that regularly runs a filter such as "due date is  today" or "updated over a week ago" and transitions any issues it finds (Obviously, I'd recommend much more careful filters than I've just suggested)

This is why I wanted to use service over listener. This is literally in my original question. Can I get more help on services?

Here's my code.

Also how do I get multiple issues to use this with JQL?

// INF 31.07.2019
// source:

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.MutableIssue;
import java.util.Date;
import java.util.ArrayList;
import com.atlassian.jira.workflow.WorkflowTransitionUtil;

/* The object facade class */
Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("");
MutableIssue issue1 = getIssueObject();

/* The reference to the object facade which you can use in your code */
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass);
def deadLine = issue1.get("customfield_11210") //deadline CustomField
def now = new Date();
deadLine = new Date(deadLine.getTime())
if(now.compareTo(deadline) >= 0){
final String remoteuser = ComponentManager.getInstance().getJiraAuthenticationContext().getUser().getName();
WorkflowTransitionUtil workflowTransitionUtil = ( WorkflowTransitionUtil ) JiraUtils.loadComponent( WorkflowTransitionUtilImpl.class );
workflowTransitionUtil.setAction(441);//Id of the status you want to transition to

Hi Gleb

You can try the following

You need to create a Scriptrunner's Escalation service. Then you will be able to point a JQL query. Something like this: project = 'Some Project' and "deadline" >= startOfDay() and "deadline" <= startOfDay()

Also, you will be able to choose CRON Expression and Action (Transition).

Yeah I've already found Escalation services myself. But thanks anyway!

Suggest an answer

Log in or Sign up to answer

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