Skip to end of banner
Go to start of banner

Rescheduling Issues

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Required plugins

You will need the following JIRA plugins:
  1. Blitz-Actions

Level: INTERMEDIATE

Problem

Let's say that we want the Project Lead to be able to easily reschedule issues in one step, setting the Fix Versions, Assignee and an optional comment.

Solution

Create the action

First off, we create the Reschedule action.

Condition Script

Then, we must make it available only for the project lead and only for issues that are not Resolved or Closed, so we write the following condition:

Condition Script
number ENABLED = 1;
number DISABLED = 2;
number HIDDEN = 3;

if(projectPM(project) == currentUser() && status != "Resolved" && status != "Closed"){
 return ENABLED;
}

return HIDDEN;

Screen Script

Next, we write the Screen Script. We must ask the user what Fix Versions to set, a new assignee (we will provide the old assignee as a default value) and a comment field.

Screen Script
string TEXT = "TEXT";
string TEXT_DISABLED = "TEXT_DISABLED";
string [] fields;

// fix versions
fields = addElement(fields, "Fix Versions");
fields = addElement(fields, TEXT);
fields = addElement(fields, "");

// assignee
fields = addElement(fields, "Assignee");
fields = addElement(fields, TEXT);
fields = addElement(fields, assignee);

// comment
fields = addElement(fields, "Comment");
fields = addElement(fields, TEXT);
fields = addElement(fields, "");

return fields; 

This will generate the following screen

Type conversion

 Don't forget that assigning a string value containing pipes to a string array, will split the original string at the position of each pipe. Therefore, we can use "1.0|2.0" as a value for Fix Versions to set multiple values.

Action Script

Finally, the Action Script.

Action Script
string [] fvers = getElement(argv, 1);
string newAssignee = getElement(argv, 3);
string comment = getElement(argv, 5);

fixVersions = fvers;
assignee = newAssignee;
if(isNotNull(comment)){
	addComment(key, currentUser(), comment);
}


That's it! You now have a powerful tool, reusable across multiple projects!

  • No labels