Help me to configurate it validation.

Issue #235 closed
Serj Shcherbakov created an issue

Hi!

I have 3 fields:

Booked from - Data/Time Booked to - Data/Time

Enviroment - Options/Single Choice

What i want:

I need to block issues transitions if selected Dates (Booked From/To) and Enviroment is setted on exist issues in status Reserved.

Example:

Someone created jira issue with parameters Booked from: 27/Jan/16 10:56 AM & Booked to:28/Jan/16 10:56 AM & Enviroment = EvCPE,

And now i need to block issue creation with the same parameters until the status of this issue will not change.

How can i configurate it is?

Please help! Thanks, Sergey,

Comments (20)

  1. Fidel Castro Armario repo owner

    Hi Sergey,

    A pair of questions:

    1. Can we restrict the search for same parameters to issues of a same project? This would improve performance.
    2. Don't you find more suitable a validation to avoid time intervals overlap? That is, to avoid a new issue with same Environment as another in Reserved status when there is time interval overlap, instead of same values for fields Booked From and Booked To.
  2. Herman Saroka

    Fidel Castro Armario can you please describe your 2nd comment in a not so complicated way. Too complex for understanding, sorry)

  3. Fidel Castro Armario repo owner

    Sorry, I should have read twice my redaction. A revised redaction of my question:

    Don't you find more suitable a validation to avoid time intervals overlap? That is, to avoid a new issue to be created if there is another issue in Reserved status which has:

    • Same value in Environment field.
    • Time interval defined by values in fields Booked From and Booked To in both issues, are overlaping totally or partially. Example: 2016-01-28 14:00 - 2016-01-29 14:00 and 2016-01-29 13:00 - 2016-01-29 19:00 overlaps partially from 2016-01-29 13:00 to 2016-01-29 14:00.
  4. Herman Saroka

    nevermind. Great, you totally named our 2 cases: 1) total overlaping 2) partially overlaping

    What solution can you suggest please ?

  5. Fidel Castro Armario repo owner

    You can do it using validator "Validation based on JQL query" with the following configuration:

    conf-0.png

    JQL Query is:

    project = %{00018} AND cf[12202] = "%{12202}" AND ("Booked From" >= "%{12200}" AND "Booked From" < "%{12201}" OR "Booked To" > "%{12200}" AND "Booked To" <= "%{12201}")
    

    or

    project = %{00018} AND cf[12202] = "%{12202}" AND (cf[12200] >= "%{12200}" AND cf[12200] < "%{12201}" OR cf[12201] > "%{12200}" AND cf[12201] <= "%{12201}")
    

    Note that in my particular JIRA instance:

    • "Booked From" custom field uses field code 12200.
    • "Booked To" custom field uses field code 12201.
    • "Environment" custom field uses field code 12202.

    Replace 12200, 12201 and 12202 in JQL expression for the corresponding field codes in your JIRA instance.

    Once configured, transition "Create Issue" will look like this:

    conf-1.png

  6. Serj Shcherbakov reporter

    Fidel, thank you so much. Can you describe more:

    In your's JQL i cant find this code's: 12000, 12001, 12002

    instead of this i see: 12200, 12201, 12202

    This confused me a little bit.

  7. Serj Shcherbakov reporter

    Anyway my configuration according your JQL look like:

    asad.jpg

    Where:

    "Booked From"* custom field uses field code 20114. "Booked To" custom field uses field code 20115. "Environment" custom field uses field code 20225.

    aasdas.jpg

    And Finally dosent work.

  8. Fidel Castro Armario repo owner

    Sorry, there was a mistake in the JQL, since 1 ilegal cases were not included. Use the following JQL query instead:

    project = %{00018} AND cf[12202] = "%{12202}" AND (cf[12200] >= "%{12200}" AND cf[12200] < "%{12201}" OR cf[12201] > "%{12200}" AND cf[12201] <= "%{12201}" OR cf[12200] <= "%{12200}" AND cf[12201] >= "%{12201}")
    

    Replace 12200, 12201 and 12202 in JQL expression for the corresponding field codes in your JIRA instance.

  9. Herman Saroka

    Fidel we faced with another problem: We tryed to use your query and it reflects no opportunity to refresh the booking time into necessary ticket. The query "looks" on itself but must check other tickets with the same field "Environment" in the same day. While changing dates/time in the ticket it starts to check itself in the first order.

    Does it exist an opportunity to move time/dates ?

    Thanks.

  10. Fidel Castro Armario repo owner

    Hi Herman,

    In my JIRA instance it's working perfectly. Can we have a videoconference by Skype? I would like to see the problem in direct.

    My Skype user is fidel100r. I will be available until 13:00 UTC.

  11. Serj Shcherbakov reporter

    Hi Fidel!

    How can I limit the verification? I need to check with just a tickets with status Resolved

  12. Fidel Castro Armario repo owner

    Simply add term status = "Resolved" AND at the beginning of your JQL query:

    status = "Resolved" AND project = %{00018} AND cf[12202] = "%{12202}" AND (cf[12200] >= "%{12200}" AND cf[12200] < "%{12201}" OR cf[12201] > "%{12200}" AND cf[12201] <= "%{12201}" OR cf[12200] <= "%{12200}" AND cf[12201] >= "%{12201}")
    
  13. Log in to comment