Validation based on JQL query is not working

Issue #36 resolved
Flavio Beck created an issue

Hi,

I am trying to add a validation based on JQL query to avoid issue duplication and it is not working:

JQL query: project = "%{00018" AND cf[11011] = "%{11011}"

It is searching any issue in the same project with same value of custom field 11011

Codition: {00058}=0

I can see folowing jira log output:

FIELD VALUE BEFORE BEING CONVERTED TO STRING OBJECT "Project key" BELONGS TO CLASS "class java.lang.String" AND CONTAINS VALUE "XXX".

CUSTOMFIELD VALUE OBJECT "Carrier" BELONGS TO CLASS "class com.atlassian.jira.issue.customfields.option.LazyLoadedOption" AND CONTAINS VALUE "COL".

FIELD VALUE BEFORE BEING CONVERTED TO STRING OBJECT "Carrier" BELONGS TO CLASS "class com.atlassian.jira.issue.customfields.option.LazyLoadedOption" AND CONTAINS VALUE "COL".

VALUE BEFORE PROCESS TO BE ASSIGNED OBJECT "Ephemeral number 1" BELONGS TO CLASS "class java.lang.Integer" AND CONTAINS VALUE "0".

It means the query returned 0 and according to defined condition, the validation should be True.

out put:

$assertionsDisabled - boolean - true VALUE AFTER PROCESS TO BE ASSIGNED OBJECT "Ephemeral number 1" BELONGS TO CLASS "class java.lang.Double" AND CONTAINS VALUE "0.0".

I understand the log is OK, validation is TRUE.

But I got the Message that validation fails, and I cannot proceed.

I already tried other queries: (hardcoded) project = "XXX" AND "Carrier" = "COL"

same result: 0 issues

but stil not able to proceed.

Please bring me some light on that.

Thanks

Comments (10)

  1. Fidel Castro Armario repo owner

    Hi Flavio,

    Use the following JQL query: project = "%{00018}" AND cf[11011] ~ "%{11011}"

    and the following formula: {00058}=1

    You should have a configuration similar to the one shown in the following screenshot:

    Captura de pantalla 2014-04-11 a la(s) 23.32.45.png

    Some explanation:

    • You didn't close field code for project key: %{00018
    • You have to use operator ~ instead of = (I'm not completely sure since I don't know the type of field of cf[11011]).
    • If there isn't repetition of issues, the query will return 1, since current issue matches the query.
  2. Rafael de Camargo

    Hi Fidel. I'm here in behalf of Flavio.

    I figured out that the problem is in the Creation transition.

    If I create this validator on another transition, it works perfectly, but on creation, it fails all the time, no matter the expression I put.

    I even tried {00058} > 0, and it fails...

    Do you have any suggestions?

  3. Vitaly Grinko

    Sounds great! I am facing the same problem and trying to find workaround until new version of plugin becomes available. In my company it may take time until they update plugin, so could you please give some details on the bug so I could try to find temporarily workaround.

  4. Fidel Castro Armario repo owner

    The problem is due to the way "Ephemeral number 1" field is implemented. It needs the issue to be created in order to be used, and since "Create Issue" transition has not been yet executed when validator is used, the issue is not actually created by that moment.

    The new version solves the problem, as it allows the field to be used even if the issue has not been created.

    The only workaround I can think of is to insert the validator temporarily in another transition, at least you will be able to warn the user that the issue is duplicated, and ask him to delete it.

  5. Vitaly Grinko

    Thank you. In our case it does not make too much sence to do verification during other transitions then Create, so I will wait for the update (2.1.16) come our from Beta phase. Thanks again!

  6. Fidel Castro Armario repo owner

    Hi,

    I'm really sorry for not having been able to release the new version (2.1.16) of the plugin today. This new version has many important improvements and new features, that require extensive testing to guarantee backwards compatibility, and revision of documentation and interface.

    The new due date for the release of version 2.1.16 is monday 5th May.

    Regards,

    Fidel

  7. Log in to comment