How to update due date field with priority

Hello Atlassian Experts,


I have a requirement where , the due date field should be automatically updated with the priority value provided.

After going through lots of post related to this in Atlassian Community, I came across a script (adding below) that can serve this purpose .


import java.sql.Timestamp
import com.atlassian.jira.issue.MutableIssue
// initializing the priority

def BLOCKER = 1;
def CRITICAL = 2;
def MAJOR = 3;
def MINOR = 9;
def Trivial = 30;

// calender which returns the date according to the priority defined

private GregorianCalendar getDate(double roll){
        Calendar cal = Calendar.getInstance();
        for (int x=0;x<roll;x++){
        return cal;

MutableIssue mutableIssue = (MutableIssue) issue;
def priority = mutableIssue.getPriority().getString("name");
def setDueDate = mutableIssue.getDueDate();
 //only set the dueDate if the date isn't already set (i.e. if it == null).

        GregorianCalendar cal;

                cal = getDate(CRITICAL);
        } else if(priority.equals("Major")){
                cal = getDate(MAJOR);
        } else if(priority.equals("Minor")){
                cal = getDate(MINOR);
        Timestamp dueDate = new Timestamp(cal.getTimeInMillis());

But I am facing an error in the for loop  for (int x=0;x<roll;x++){

Error: 3 expression are required in classic for loop, you gave 4.

I am a newbie in javascript can anyone please help me out.


Thanks ,


1 answer

Hi Kartik,

You have copied in the encoded less-than symbol. Instead of:

for (int x=0;x<roll;x++){

You should have:

​for (int x=0;x<roll;x++){

You'll notice the fix is to switch out &lt; for <

I hope this helps!


Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,253 views 14 20
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot