Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

I need to collect user mobile numbers from custom field

Hi,

I need to collect user mobile number from the custom field (Text filed).

When users entered Alphabets system throws error message under the custom filed,

Need groovy script for this condition.

Kindly help me

 

Regards;

2 answers

2 accepted

1 vote
Answer accepted
brbojorque Community Leader Jan 03, 2020

Hi @Thangavel VELUCHAMY ,

Please check this Behaviour Script below, it is a very generic validator using regex, you can formulate your own pattern using other tools like so below.

https://regexr.com/3c53v

http://regexlib.com/Search.aspx?k=phone&AspxAutoDetectCookieSupport=1

 

Add this script to the Telephone field in the Behaviour.

def customField = getFieldById(getFieldChanged())

def pattern = /\D?(\d{3})\D?\D?(\d{3})\D?(\d{4})/
def errorMessage = "Not a valid phone number, you must enter the proper format e.g (111) 222-3333"

if(customField.getValue()){
def matcher = customField.getValue() =~ pattern

if(!matcher.size()){
customField.setError(errorMessage)
}else{
customField.clearError()
}
}else{
customField.clearError()
}
0 votes
Answer accepted

Hi @Thangavel VELUCHAMY 

You can use the 'Number Field' type for the custom field instead of Textbox.
So the user will be allowed to enter only numerals.

You can add a help text for the field just to inform the users for any format to be followed, though the format will not be checked by Jira.

Regards
Gikku

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you