Hi Community,
i found several similar topics but none gave a clear answer.
Is it possible to do this with the help of any tool that we have in the house. JMWE, ScriptRunner or automation?
Best regards
Jurica Petricevic
Hi Jurica,
If you wanna do this with JMWE, you can easily implement it with Scripted (Groovy) Validator. Once you have added the validator set its parameters as followed:
Groovy script:
issue.get("customfield_10600")!=null && issue.get("customfield_10600")>=now
Error message:
The field "End of Project" must be precisely defined. Check your entry once again
For field:
@Sayed Bares {Appfire} Thank you for your answer.
I have one more question here. Is it possible at this point to make a connection to the Fixtermin field?
In front of the End of Project field there is a fixtermin field to which the standard answer is No. If No in that field, it is necessary to allow any values, including the entry of an empty end of project field.
if in the field Fixtermin Yes then it is necessary to use the mentioned script where the value in the fields End of project may be the same or greater than today.
Do you have any suggestions here?
Best regards
Jurica Petricevic
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jurica,
You can use the following code for your use case:
if (issue.get("customfield_10700")!=null && issue.get("customfield_10700")=="Yes"){
issue.get("customfield_10600")!=null && issue.get("customfield_10600")>=now
}
else true
customfield_10700 is the ID of fixtermin field and customfield_10600 is the ID of End of Project field.
You can also use the following code which does the same thing but just in one line:
issue.get("customfield_10700")!=null && issue.get("customfield_10700")=="Yes"? issue.get("customfield_10600")!=null && issue.get("customfield_10600")>=now : true
Hope it helps and let us know how it goes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Sayed Bares {Appfire} great job. the only problem i have is that Fixtermin yes option selected does not allow me today's date. This was possible in the first script.
Can you understand why?
Thx a lot mate.
Bets regards
Jurica
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jurica,
Glad it is working now and you are most welcome :)
To fix todays issue please use the following code:
issue.get("customfield_10700")!=null && issue.get("customfield_10700")=="Yes"? issue.get("customfield_10600")!=null && issue.get("customfield_10600")>=today : true
or the following code which is much shorter and easier to implement:
issue.get("customfield_10700")!="Yes" || (issue.get("customfield_10600")!=null && issue.get("customfield_10600")>=today)
Let me know if you have any further questions or concerns.
Best,
Sayed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It was solved with
Simple scripted validator (script Runner)
Condition:
Date now = new Date()
cfValues['End of project'] >= new Date(now.getYear(), now.getMonth(), now.getDate())
Error Message:
The field "End od Project" must be precisely defined. Check your entry once again.
Field:
End of project
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.