Hello, when a user closes an issue and chooses either the complete, done, or fixed resolution, the time tracking field should not be empty. I don't want to require that field when the resolution is anything else, like clone, won't fix, duplicate.
I can pass this when testing the expression but when I attempt to test it on a real issue, the error message will not show up.
Tried:
issue?.timeSpent == null &&
issue?.resolution?.name == "Complete"
Also tried:
['Complete','Fixed','Done'].includes(issue?.resolution?.name) && issue?.timeSpent == null
Field that I want to not be empty:
I was able to get it to work using the resolution IDs below but now the validation shows up for every resolution selected
issue?.timeSpent == null &&
issue?.resolution?.id == 6 && 1 && 10000
Hi @Martinez, Diego ,
Could you try the following expression? In this case, the transition will not be performed (it will return false) if the timeSpent is null and the resolution is one of the mentioned.
issue?.timeSpent == null && (issue?.resolution?.id == 6 || issue?.resolution?.id == 1 || issue?.resolution?.id == 10000) ? false : true
Is this the expected behavior?
If not, feel free to contact us via our Support Service Desk.
Best regards,
Nacho
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nacho Moreno Ortega This worked! Thank you, it should return false so the user can input time spent if it is not there. When it comes to the colon syntax, can you show me where that is in the JWT notes?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Martinez, Diego ,
I'm glad that it has worked!
You can find information about the corresponding operator in the section "Conditional operator" on the following page of our documentation: Operators
If you need anything else regarding our applications, please do not hesitate to contact us.
Best regards,
Nacho
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Martinez, Diego,
I am part of the Decadis team and I would like to help you with this JWT for Jira Cloud configuration.
The problem here could reside in the part of the expression that evaluates the time logged in the transition screen. We elaborated the use case Validate worklogs with some relevant expressions for this purpose that could be useful here.
Could you try with the following expression? It should make logging work in the transition screen required if any of the resolutions Done, Complete or Fixed is set.
!["Done", "Complete", "Fixed"].includes(issue?.resolution?.name) || (issue?.timeSpent||0) > (originalIssue?.timeSpent||0)
Please, do not hesitate to contact us in this thread or via our Support Service Desk or visit our documentation if this does not resolve your problem.
Best regards,
Vicente
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Vicente Domínguez _Decadis AG_ I tried that and it works for all of the resolutions but the three in the expression. When I add a time in the time tracking field and try to complete the request, it still shows the same error message and when I test it out, it gives the error below, any thoughts?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Martinez, Diego,
For some reason, I can not reply to you comment from yesterday directly. I hope that this is not a problem.
The operator "||" has been replaced with ">" in the expression of the screenshot. Does the configuration work if you use the expression that I originally provided without any change?
Please, note that the context "originalIssue" can only be evaluated during a transition, so testing this expression in our expression editor could return an error due to the unavailable context.
Please, let us know if it works after the change.
Best regards,
Vicente
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Vicente Domínguez _Decadis AG_
Apologies on the screenshot, the formula still does not work when I add an actual time spent value to the time tracking field and try to close out the issue with one of the three listed Resolutions (Done, Complete, Fixed). It does work the other way around, I do need a value for those three resolutions and I don't need to enter a value for the other resolutions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Martinez, Diego,
If the time does not need to be logged during the transition because the Log Work field is not included in the transition screen, but before the transition is executed, the expression should be a bit different.
let wk = issue.worklogs;
!["Done", "Complete", "Fixed"].includes(issue?.resolution?.name) || (wk != [] && wk[wk.length-1].timeSpent > 0)
This expression evaluates if time was ever logged in the transitioned issue while the previous one evaluates if time was logged in the transition.
Does it work for you?
Best regards,
Vicente
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.