I have created a Issue field "TTL", where it will accept only numeric value in seconds. I need to set the limit to be accepted any where between (>= 60 seconds and <=8400 seconds). PFA. Any one kindly assist how to set the limit ?
Why do you want to convert the form field value to a String and use Regular Expressions?
Since you have the requirement to check if the value entered into the field is from the range of 60 to 8400, why not just convert it to a numeric type, i.e. Integer or Long?
It would help if you tried something like:-
def field = getFieldById(fieldChanged)
def fieldValue = field.value as Integer
field.clearError()
if(fieldValue && (fieldValue < 60 || fieldValue > 8400)) {
field.setError('The Value Entered is out of Range')
}
Please note that the sample code provided is not 100% exact to your environment. Hence, you will need to make the required modifications.
I hope the sample code above helps to solve your question. :)
Thank you and Kind regards,
Ram
@Ram Kumar Aravindakshan _Adaptavist_ you are right, i have later updated as integer value. thanks for the above script, it helped.
Minor update, there was missing close bracket ')' , i have updated and used.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad to hear the solution worked for you. :)
Thanks for letting me know about the code error; I have updated the sample code.
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Hemanth Kumar ,
you can't do that using builitin features. You need to use a third part plugin such as ScriptRunner to put in place a rule through a behaviour.
Fabio
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.
@Fabio Racobaldo _Herzum_ I was able to create script with some help of google/community and figured out to ranging from 60 to 100, but can you assist how to fix the range to 3 digit and 4 digit value. (as mentioned in above - 60 - 8400 is my requirement)
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.
@Ram Kumar Aravindakshan _Adaptavist_
I was able to create script with some help of google/community and figured out to ranging from 60 to 100, but can you please assist how to fix the range to 3 digit and 4 digit value. (as mentioned in above - 60 - 8400 is my requirement)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.