Hi,
I'm looking for a Solution to restrict a numeric custom field for accepting only positive integers or value Zero
In few occasions, members are entering an invalid numbers, such as:
-negative numbers
Need restriction on the numeric field in global level projects.
Can anyone suggest on this please?
Thanks,
Hi @Likhita ,
Then you can try with script runner behavior script.
Map the Behavior to Projects and Issue Types: In the 'Fields' section, map the behavior to specific projects and issue types where you want this restriction to apply.
Add the Field: Click on 'Add Field.' Select the numeric custom field you want to apply the validation to.
Write the Script:
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def numericField = getFieldById(fieldChanged) // Replace with your field's ID
def numericValue = numericField.getValue() as Double
if (numericValue != null && numericValue < 0) {
numericField.setError("Please enter a positive number or zero.")
} else {
numericField.clearError()
}
Hi ,
Thank you for your quick response and help.
Using Validator we can restrict only at specific transition level if i want to add it for all the projects then I need to add in all the workflows its time taking process.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi @Likhita
You can use a REGEX Cf provided by the app : https://marketplace.atlassian.com/apps/1228536/advanced-custom-fields?hosting=cloud&tab=overview
Regards,
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.