You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Hi there. Using either ScriptRunner / JSU / JMWE, is there a way to satisfy the following conditions:
Fields:
Conditions:
Examples:
We've been able to make some progress to check use ScriptRunner's Regular expression validator [ScriptRunner] to be able to make something like this happen with the following:
^https:\/\/google.com\/.*.pdf
However, I struggle to expand the script above to interact with another field. Any insights is appreciated!
with JMWE, you could use a Scripted (Groovy) Validator with code like this:
switch (issue.get("File Source")) {
case "Google": return issue.get("File Source URL") ==~ /^https:\/\/google.com\/.*.pdf/
case "Yahoo": return issue.get("File Source URL") ==~ /^https:\/\/yahoo.com\/.*.pdf/
default: return true //no check if another source
}
Hi David. Thank you the response! Is it also possible to conditionally display a different error message for each one (depending on the File Source value)?
Example:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Absolutely! Instead of returning a boolean value (true/false), you can return a String that will be the error message:
switch (issue.get("File Source")) {
case "Google": return issue.get("File Source URL") ==~ /^https:\/\/google.com\/.*.pdf/ ?: "The URL is not from Google"
case "Yahoo": return issue.get("File Source URL") ==~ /^https:\/\/yahoo.com\/.*.pdf/ ?: "The URL is not from Yahoo"
default: return true //no check if another source
}
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.