Issue with validation
Hi Fidel,
I want to validate that when creating an issue, its DueDate isn't later than the duedate of a given issue in the project. Based on this:
I followed both approaches, but it won't let me create the issue when its duedate is less than the duedate of the given issue (it should).
These are the validations in transition Create Issue:
count(filterByIssueType(getIssuesFromProjects(%{00018}), "TareaProyecto"))= 0 OR count(filterByFieldValue(filterByIssueType(getIssuesFromProjects(%{00018}), "TareaProyecto"), {00012},<, {00012})) = 0
alternatively,
project = "%{00018}" AND issuetype="TareaProyecto" AND duedate < "%{00012}" {00058}=0
TareaProyecto is a "singleton" in the project. It represents the project, so the idea is that when I create other issue types in that project they can't have a duedate later that that of that issue. Example:
DD TareaProyecto = 13/10/2015 DD any other issue in that project shouldn't be 14/10/2015 or later, only 13/10/2015 or earlier.
Comments (20)
-
repo owner -
repo owner Which version of JIRA are you using?
-
reporter 6.1.5
-
reporter I recorded the issue here:
-
repo owner Let's do some debugging. Please, do the following temporary changes to "Create issue" transition in order to create a debug comment:
1) Remove the validator, or inhibit it adding a term like "true OR".
2) Add a "Copy a parsed text to a field" post-function with the following configuration:
- Target field: New comment
- Parsing mode: Advanced
- Text to be parsed:
"Issues TareaProyecto: " + toString(filterByIssueType(getIssuesFromProjects(%{00018}), "TareaProyecto")) + "\n\n" + "Issues TareaProyecto filtered by Due Date: " + toString(filterByFieldValue(filterByIssueType(getIssuesFromProjects(%{00018}), "TareaProyecto"), {00012},<, {00012}))
Please, let me know which comment is generated.
-
reporter This is what I get in the comment:
Issues TareaProyecto: TDAI-22
Issues TareaProyecto filtered by Due Date: TDAI-22
-
reporter - attached WTB1.png
Thi is how the postfunction look like.
-
reporter I created 2 issues, one with the duedate earlier and the other later, in both cases I got the same comment as above.
I think that in the first case it should be empty and in the second have TDAI-22
-
reporter Fidel, the problem is the DueDate that is reading from TareaProyecto. I add the postfunction attached to print both. The current issue is OK (12/10/2015 as entered in the screen), but the one from issue TareaProyecto is wrong (it's 13/10/2015, not 09/10/2015).
This is what I get in the comment:
Issues TareaProyecto: TDAI-22
Issues TareaProyecto filtered by Due Date: TDAI-22
Current Issue Due Date:1.4446188E12
2015-10-12
TareaProyecto Due Date:1.4443596E12
09/10/2015
-
reporter - attached wtb2.png
Second postfunction.
-
reporter I found the problem: the duedate read from TareaProyecto was not the last one, but the previous one. The issue view was showing 13/10/2015 as duedate but the issue navigator had 09/10/2015, the previous value for the duedate. After reindexing, all is OK. Any ideas how this can happen? I am using a postfunction to set the duedate in TareProyecto and then there is a reindex function. I have attached it here.
-
reporter - attached wtb3.png
Postfunction to set the DueDate for TareProyecto.
-
reporter - attached wbt5.png
Change history for DUEDATE.
-
repo owner Adolfo,
You found a bug: the plugin is not reindexing parent issue when a post-function has updated a field on parent issue.
I have made available the following versions fixing the problem:
- 2.2.1_beta_1 to be used from JIRA 6.2.3 to 7.0.
- 2.1.37_beta_1 to be used from JIRA 5.0 to 6.2.2.
Please, confirm that these versions solve your problem.
Thanks.
-
reporter Thanks. I will install 2.1.37_beta_1 later today. Just a question about the plugin versioning.In marketplace:
2.2 : JIRA Server 6.2.3 - 7.0.0 2.1.36 : JIRA Server 5.0 - 6.4.12
I see an overlap of versions (6.2.3 - 6.4.12) ??
-
repo owner Versions 2.1.x higher than 2.1.36 will not carry new features. The intention is to only release a version occasionally for fixing bugs.
All the new features will be implemented in versions 2.2.x.
In reality version 2.1.37_beta_1 is compatible up to JIRA 6.4.12, but it won't make sense to install it in JIRA 6.2.3 and higher, since you will be missing new features carried by JWT 2.2.
-
reporter This means new JWT features will require JIRA 6.2.3 and higher, right?
-
repo owner Yes. It's technically very costly to keep supporting a very high range of versions. For sometime, bugs will be fixed in versions compatible with JIRA 5.0 to 6.2.2.
-
reporter Thanks for the info, I will be upgrading this particular instance from 6.1.5 to 6.4.12 next week.
-
reporter - changed status to resolved
- Log in to comment
I have tried both solutions, and both are working perfectly for me. I have used JIRA 7.0 and Jira Workflow Toolbox 2.2.