It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Validation of Date Window

Is it possible to use a scriptrunner or JWT expression in the following scenario:

  • A piece of equipment has been booked between date/time A and date time B. This has been added through the portal, and an Jira agent has accepted this by marking the request "Booking Accepted" = Yes, for Equipment = "x"
  • Now, if someone else tried to put a request in that clashes with that time window it is not possible to submit the request in the portal.

I think what I'm after is, when the new request is submitted....

If date/time A of NEW request is between A and B for Equipment = X that already exists then deny the submission?

 

1 answer

Hi @James Barratt,

what you're trying to achieve should be perfectly doable with the help of Jira Workflow Toolbox - I guess you're referring to when speaking of JWT.

While the final configuration is extremly dependent on your specific configuration, I'll do my best to provide some hints being as generic as possible:

project = MYPROJECT AND type = MyIssueType AND "Equipment" = "x" AND "Booking Accepted" = "Yes" AND (("Date Picker A" >= "%{nnnnn}" AND "Date Picker A" <= "%{mmmmm}" ) OR ("Date Picker B"  >= "%{nnnnn}"  AND "Date Picker B" <= "%{mmmmm}"))

This JQL query would search for issues with an accepted booking for equipment x, where one of the dates provided falls in between the timeframe between Date Picker A and B (which means, the equipment would have already been blocked). Field code nnnnn has to match your Date Picker A and mmmmm Date Picker B.

  • Choose Number of issues etc. (the third one) in the Condition section.
  • Add the following Boolean expression:
{00058} = 0

This ensures that only if no issues are returned by the JQL, issue creation will be possible.

  • Choose Summary as the Field to show in the Message to show when validation fails section and add your custom message, e.g.
<strong>Specific date range is already blocked!</strong>

The resulting message within the portal would look like this:

sd_error_message.JPG

  • Choose a user having the browse permission for all the relevant issues in the Run as section. (This is highly important, since I assume a portal user won't be able to see other tickets.)

I hope that helps.

Cheers,
Thorsten

@Thorsten Letschert (Decadis AG)   I can never get the message that appears on the customer portal to actually show the message as you did above with 

<strong>Specific date range is already blocked!</strong>

No matter what I try to program in the message to show on failure, I only get the standard:

error.PNG

 

Any tips?

Hi @Louis Farmer ,

have you correctly selected the Summary for the Field to show option?message-to-show.PNG

If so and it's still not working - could you please tell me which Jira and JWT version you're on?

Cheers
Thorsten

I must have tried a million different settings, and I'm pretty sure I tried once the "summary" field to show but must of have something else wrong on that trial to never return to it... It works and its BEAUTIFUL :) . Thank you so much for the rapid response, would have relayed my appreciation earlier but the forum seemed down for me last week. cheers!

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you