I am using JMWE and need this validation for cost entered. Format Example: xx.yy€. How can i do it?

Barkha Singh October 26, 2023

I am using JMWE and need this validation for cost entered. Format Example: xx.yy€. How can i do it?
I need to validate the values entered and the symbol too.

1 answer

0 votes
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 27, 2023

Hi @Barkha Singh 

What is the field type of the field that contains the value to be validated?

Also, at what point do you need to validate the value? Issue creation? During a transition?

Finally, you specified Confluence Server as your platform, did you mean Jira Server?

Barkha Singh October 27, 2023

It is a custom field and we need to validate the value during issue creation .
Yes , my bad its Jira server.

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 27, 2023

What type of custom field? Single line text? Number? Other?

Barkha Singh October 27, 2023

Single line text 

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 27, 2023

Then you can use a Scripted (Groovy) Validator with a script like:

issue.get("fieldId") ==~ /\d\d\.\d\d€/

which will pass only if the text field contains a string that's exactly two digits, a decimal point, two digits and the € sign. You can use a more sophisticated regular expression of you want to accept different formats.  

Like Barkha Singh likes this
Barkha Singh October 28, 2023

Thanks David. Will try it out

Barkha Singh October 30, 2023

That works but in case i have to enter 245753.00 then do i need to give that many \d  or we have any other way to do it ?

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 30, 2023

In that case you can do:

issue.get("fieldId") ==~ /\d+\.\d\d€/

which forces to have at least one digit before the decimal point.  

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events