how do i push forward issues (e.g. bulk edit 10 issues to set start date one day later )


2 answers

1 accepted

2 votes
Accepted answer

I don't know of a way to do this through the interface. If I had to do this I'd write a simple groovy script and run it through the admin console of the Script Runner plugin by Jamie Echlin. 


The groovy code to do this is simple...I'll post an example when I'm back at my desktop

...much time passes, and 38 seconds later...

Ah...the joys of script runner, groovy and the Java Date.

enjoy. Thanks for the point.

 * moveJQLIssuesForwardOneDay.groovy
 * Purpose: 
 *          example script written for Answers post
 *            takes a jql query and runs it looping over the results
 *                inside the loop each issue has it's create date incremented by X days
 *                log some debug noise about the issues being modified
 *            exit and go play bloodbourne
 * Note: person running this script is responsible for what it does or does not do - nobody else
 * ALSO NOTE: This script leaves not history that it was run other than what appears in the log, and
 *                          even better it looks like you need to reindex the project/s that have the issues you are
 *                          modifying
 * Shameless plug:
 * Author: wc
 * Created: 20150605T220533 - 10:05 PM on 05 Jun 2015

// I don't think we need anywhere near all of these but this 'set' of imports is useful for most problems
// so I just keep with it
import com.atlassian.core.ofbiz.CoreFactory
import com.atlassian.jira.web.bean.PagerFilter

import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.*
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.issuetype.IssueType
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.util.IssueChangeHolder
import com.atlassian.jira.project.Project
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.project.version.Version
import com.atlassian.jira.project.version.VersionManager
import org.apache.log4j.Appender
import org.apache.log4j.Layout
import org.apache.log4j.Logger
import org.apache.log4j.PatternLayout
import org.codehaus.groovy.util.Finalizable
import org.ofbiz.core.entity.GenericValue
import java.sql.Timestamp;
import java.time.LocalDateTime;

// -- ------------------------------------------------------------------------ --
// -- NOTE: To actually witness any logging from this script you need to add
// --       the following Logger 'class' to the list of Default Loggers on
// --       page Admin/System/Logging & Profiling using the 'Configure logging
// --       level for another package' hyperlink. Just paste the string below
// --       (part inside the double quotes) in the 'Configure' dialog and set the
// --        log level to DEBUG
Logger log = Logger.getLogger ("ccc.groovy.IncrementCreatedOnIssuesReturnedByJQL");

// -- ---------------------------------------------------------- --
// -- Note: If the JQL query to pull your issues gives you trouble then just use the following:
// MutableIssue muteIssue = issueManager.getIssueObject("ONE-1");

// go and get a component manager
ComponentManager componentManager = ComponentManager.getInstance ( );
IssueManager issueManager = componentManager.getIssueManager();

// Get the current user
User currentUser = ComponentManager.getInstance ( ).getJiraAuthenticationContext ( ).getUser ( ).getDirectoryUser()

// Enter your issue keys into the following JQL search string - 
String jql = "issueKey in (ZP-1,ZP-2)";

// Search for Release Issue
MutableIssue releaseIssue = null;
SearchService searchService = componentManager.getSearchService ( )
SearchService.ParseResult parseResult = searchService.parseQuery (currentUser, jql == null ? "" : jql);

PagerFilter filter = PagerFilter.getUnlimitedFilter ( );
SearchResults searchResult = (currentUser, parseResult.getQuery ( ), filter);
List<Issue> issues = searchResult.getIssues ( );
Integer issueCounter = 0;

if(issues != null) 
    log.debug("Count: " + issues.size() + " issues returned by query");
    for(Issue issueObject : issues)
        Long issueId = issueObject.getId();
        MutableIssue mutableIssue = issueManager.getIssueObject (issueId);
        if (mutableIssue != null)
            log.debug("Processing Issue: " + mutableIssue.getKey());
            Timestamp created = mutableIssue.getCreated();
            String msg = "  incrementing issue created date from: " + created.toString() + " to ";
            Calendar c = Calendar.getInstance();
            c.add(Calendar.DATE, 1);
            Timestamp newCreated = new Timestamp(c.getTime().getTime());
            log.debug(msg + newCreated.toString());
    log.debug("Exiting - processed: " + issueCounter + " issues this time");      
    log.error(" returned no issues...sorry");


Please be sure to run it with a single issue jql query - and as always to be safe do a XML export first at a minimum.



Thank you so much!

Looking forward for the example!!!

you get a chance to try that groovy script out yet?

Dear William thank you so much for your help! I am looking for something customisable, a script in which i can pass a set of issues (selected from Jira) which are assigned to a user (selected from Jira). Ideally, it would be like a button on the Bulk Edit Screen (e.g. "Shift Planned start date").

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,769 views 18 21
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you