You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
We have a custom field where we want to get inputs between 1-10 only, and inputs apart from this range should give error message. So when we put incorrect value it gives the error message but after clearing the incorrect value and trying to keep the field blank it still throws error message.
This is the script which we are using:
def abvField = getFieldById("customfield_12404")
def abvValue = getFieldById("customfield_12404").getValue() as Integer //Actual Business Value
if (abvValue > 10 || abvValue <1 )
{
abvField.setError("This field should contain a number value between 1-10")
}
else { abvField.clearError()}
Hi @anshu02
Seems like this is a known issue with behaviour it does not work on when field clears it keep on holds the previous value
The workaround I can suggest you to consider script validator in workflow or custom listener
you can place validator script something like below
def value = cfValues['Filed Name for validation'] as Integer
if(value){
if(value < 11 && value > 0){
return true
}
else{
return false
}
}
else{
return true
}
BR,
Leo
Is there still no fix for this yet? @Leo
Really need to make use of the behavior plugin instead of the validator and this bug is causing huge trouble.
Would really appreciate any help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have encountered the same issue on my end as well. Can someone comment on a possible workaround?
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.
Looks like `clearError()` does the trick, this is working:
import com.atlassian.jira.component.ComponentAccessor
import static com.atlassian.jira.issue.IssueFieldConstants.*
def assignee = getFieldById(ASSIGNEE)
assignee.setRequired(true) // marks with red star. Unassigned still a valid value so:
def newAssignee = assignee.getValue() as String
// clear any previous error and then be sure the ticket gets assigned
assignee.clearError()
if (!newAssignee || newAssignee == "-1") {
assignee.setError("Assignee is required")
}
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.