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!
Community moderators have prevented the ability to post new comments.
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:
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
}