How to set a restriction on changing the due date?

Ivan Ivanov September 3, 2019

Maximum date change: 10 days from the current date.

The restriction should work on the editing and viewing screens.

Any ideas?

 

2 answers

1 vote
Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 3, 2019

Hi @Ivan Ivanov ,

To my knowledge this is not possible out of the box. You could use an add-on for that, such as scriptrunner's behaviours.

Antoine

Ivan Ivanov September 3, 2019

@Antoine Berry  It’s probably not possible to configure the restriction. The field Due Date is missing when configuring through scriptrunner's behaviours.

Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 3, 2019

@Ivan Ivanov you should be able to select the Due Date field in behaviours : 

image.png

You can then use this script snippet to restrict the due date : 

import groovy.transform.BaseScript
import com.onresolve.jira.groovy.user.FieldBehaviours

import java.sql.Timestamp

@BaseScript FieldBehaviours fieldBehaviours

def duedateField = getFieldById("duedate")
def duedate = duedateField.getValue()
def maxDate = new Timestamp(new Date().getTime() + 10 * 24 * 60 * 60 * 1000);

if (duedate != "" && new Timestamp(duedate.getTime()).compareTo(maxDate) > 0){
duedateField.setError("The due date cannot be set further than 10 days.")
}
else {
duedateField.clearError()
}

Hope that works for you

Ivan Ivanov September 3, 2019

@Antoine Berry  We do not have this field in the search. Probably, we have the old version of the plugin installed. I will try to do it after the update. Thank you very much!

Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 3, 2019

Make sure you have not selected it previously in the configuration, because this field has been around for a long time.

Ivan Ivanov September 3, 2019

No, we have not selected it previously in the configuration. And now the field is not in the list.

0 votes
Fazila Ashraf
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 3, 2019
Ivan Ivanov September 3, 2019

@Fazila Ashraf  This option will work on the transition. I need to set restrictions when editing a task.

Suggest an answer

Log in or Sign up to answer