Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Blocking out days in a custom date field

Scott Martin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 9, 2018

Is there a way (Or and app) to script a date field to block out days if x amount of requests have due dates for a specific day. 

 

Example: The team has a capacity of 10 requests per day. 10 requests were submitted with a due date of 10/21/2018. An 11th request is being submitted and the user cannot select 10/21/2018 on the custom calendar field because the team reached their capacity for that specific day. So it's grayed out.

 

Thanks,

Scott

1 answer

0 votes
Radek Dostál
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 9, 2018

Hmm I'll just throw in what comes up my mind, maybe you or someone else can use it in some way,

 

You would be needing to implement some form of an automated Issue Search and then do some magic off that. This implies a custom script that will utilize JIRA's Java API. Most known and probably best suited is ScriptRunner for Jira which I'm beginning to think can really do just anything these days.

 

So let's say a user tries to create an issue and selects a due date X. They press Create.

Then you have a custom scriptrunner validator on the 'create' transition, which will automatically perform an Issue Search, e.g. "project = Y and dueDate = X"; if you get 0-10 issues returned, all is good. If there is 11 or more, throw a (customizable) error message for the user to select a different date as the team is fully booked.

 

I don't think you can just gray out a certain date from the calendar pop-up, you can just gray out the field altogether as read-only (plugins, such as ScriptRunner behaviours) but that wouldn't be helpful as no date could be selected.

 

You can do a REST call with JavaScript so maybe that would be one way as well, but since JS executes after the create form is loaded, rather than when 'Create' is pressed, I'm not sure. Even if you made it work for the final Create confirmation, Jira already started creating the issue anyway so at most you would just add an alarm continue yes/no with some info before the actual create request is sent. Not too effective.

Nope, I think you would need some internal validator, such as what SR provides.

 

Anyhow this is just what comes to mind as an initial idea, maybe someone has a better idea?

Scott Martin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 10, 2018

Thanks Radek!

Suggest an answer

Log in or Sign up to answer