I try to validate a custom number field. I tried this insde the transistion from create->open
Everytime I try to create the issue I get an error:
````
"errorMessages": [ "Jira expression failed to parse: line 1, column 5:\n=, =>, ., ?., [, ?.[, (, *, /, %, +, -, <, <=, >, >=, ==, !=, &&, ||, ??, ?, ; or EOF expected, targetField encountered." ],
````
Maybe I have missed something with the following script?
````
````
Hi Ingo,
I can confirm that inside Jira cloud, validators use the Jira Expression Framework provided by Atlassian.
Your code will not work as you must use the syntax for the Jira Expression Framework in your validator.
We have some examples in our docs page here that show this syntax. They will help you create the validator that you require.
I hope this helps.
Regards,
Kristian
Welcome to the Atlassian Community!
I don't know where you got this code from, but it is very wrong
Line 2 tries to cast a string to a number with the "as Number" statement, so the variable will contain nothing unless the string really is just a number.
Line 3 tries to set a regex pattern into a variable, but does not specify a valid string, it contains a load of control characters, which is probably why you are seeing the "unexpected end of file" error.
Line 4 has an invalid comparison ( you need to decide whether you mean "equals" or "like", "equals like" is total nonsense. Or combine them with a "or" statement: if x == y OR x is like y)
And, in general, you are trying to specify a regex string to check the value, but you're not actually trying the regex on the string. == and ~ are not regex comparisons.
I suspect line 3 could be causing the script error you are seeing (but it does look like you may not have given us all of it, so it might be another line we have not seen)
A good example of how to use a regex in a script is at https://library.adaptavist.com/entity/use-regex-to-find-emails-address
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.