Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

groovy script for validation of custom fields

Ak
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 11, 2022

I have a Requirement that i need to Validate the custom fields using custom context drop down types. Example Let say i have values field and type field option in that case if i select Numbers the value field should take only values similarly if i select alphabets it should take only alphabets.
i need some groovy script to validate my requirement

1 answer

0 votes
Sebastian Krzewiński
Community Champion
February 11, 2022

Hi @Akhil 

 

Correct me if I misunderstand what you wrote.

You want to validate select list field if based on other text field. If text field will have number values select field should also have number values. For text values in text field - select list should have text values.

Based on above:

- do you validate text field to get only 2 scenarios (numbers in field or text in field)?

- what happen when someone in text field use e.g. Adam123 or 123Adam?

 

Regards,

Seba

Ak
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 11, 2022

Hi @Sebastian Krzewiński ,
So i have two custom fields one is text box which accepts the values and another one is custom context Field which user has to select options like A B C D in this case if User select A then it should take only alphabets and if user select the option B then it should accept only alphabets

in that case:
if user Selected option A and given some numerical values it should say that invalid entry or some error message

One more example for my use case i have three custom contexts which (email, Mobile Number, Website) if the person selected an email option it should take only email format and similarly if the person selected the mobile no it should take allow numbers format.

Thanks&Regards,
AK

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events