Send message if JQL query passes validation

Issue #367 resolved
Ian Juliff created an issue

Hi Fidel,

I have the following query

issuekey = "%{00015}" and issue.property[development].prs > 0 and "%{11401}" is Empty

Which tells me if the current ticket has a pull request but has not got a System set.

What I would like to do is send a validation message if the condition is met. I know I can send it if it fails the validation but that doesn't help me as I only want to send the validation when it is has a pull request.

Is there anyway of doing this?

What would be useful is an extra option on the "Validate by JQL option" to send if validation message wehn query PASSES instead of fails

Comments (13)

  1. Fidel Castro Armario repo owner

    Validations are features to prevent a transition from being executed under certain circumstances. They show a custom message to the user in order to explain the reason the transition can't be executed.

    Do you want to show a message, and let the transition to be executed anyway?

  2. Ian Juliff reporter

    No i want it to stop the execution if the "JQL validation condition" is met? Rather than stopping if it it fails validation?

    It may be possible i'm just not sure how?

    Regards Ian

    Ian

  3. Fidel Castro Armario repo owner

    Can you please attach a screenshot of your current validation configuration?

  4. Ian Juliff reporter

    Or can I change the JQL so it will fail validation when there is a pull request and system field isn't set (It has to meet both conditions)

  5. Fidel Castro Armario repo owner

    Try the following changes:

    1) Use the following JQL Query:

    issue.property[development].prs > 0 and System is Empty
    

    Note that I have replaced field code for System custom field with the name of the field. I don't know which is the exact name of the field, please check it up.

    2) Update Condition parameter selecting "current issue doesn't belong to output of the query".

    Please, let me know if it satisfies your needs.

  6. Ian Juliff reporter

    Hi Fidel,

    I tried that, the problem is that then stops all tickets which don't have PULL requests.

    I specifically want to restrict tickets with PULL requests that don't have the System field set. I'm not sure if there is a way of writing a conditional JQL query?

    If issue.property[development].prs > 0 then If System is Empty then "Fail Validation" End If End if

    Its the fact I need both elemetns of the query that is causing the problem and that PULL Requests isn't a field as such restricts me to JQL rather than the other field functions.

    I there another way i could stop tickets with pull requests and a filed not set?

    Ian

  7. Fidel Castro Armario repo owner

    I'm pretty sure that your needs can be satisfied with current "Validation based on JQL query".

    It shouldn't stop issues with "issue.property[development].prs = 0" since those issues are not returned by JQL ("issue.property[development].prs > 0 and System is Empty"), thus they satisfy the condition we have selected, i.e. "current issue doesn't belong to output of the query".

    According to my understanding of the problem, my solution should work.

    Please, tell me where I am wrong.

  8. Ian Juliff reporter

    Hi Fidel,

    I think there might be a bug in the code. I am guessing it might be with regards to the issue.property[development].prs

    The validation works perfectly for ISSUES with PULL requests, however it is throwing the validation warning for ISSUES with NO PULL requests when the System field isn't set. I know the issue.properties are not core JIRA functionality, strange though. Is it possible to have a look?

    Ian

  9. Fidel Castro Armario repo owner

    Hi Ian,

    I don't think the problem has to do with issue properties in JQL queries, since the plugin is using the same JIRA service that executes the JQL query from JIRA UI.

    Please, tell me:

    • Which type of custom field is System?
    • Have you replaced "%{11401}" with it's field name? If the field name has spaces you should write it between double quotes.
  10. Ian Juliff reporter

    Sorry Fidel,

    I have just replaced the (system field ID) with System and it is working fine now.

    Sorry you told me to do that right at the start. Sorry i have wasted your time but thanks so much for your help.

    Regards,

    Ian

  11. Fidel Castro Armario repo owner

    It doesn't matter, Ian. I'm glad to see you achieved to implement the validation successfully.

  12. Log in to comment