The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I need to ask after a condition if some radio buttons fiels are filled.
I dont' want to user the simple scripted validator. Because I will need create a lot of them.
How I can do a validator using a custom script validator???
cfValues doesn't work in custom script validator. And I have an error hen the fiels are empty because I can't get a null value into a variable.
thanks in advance.
I think it would be something like this:
def cs = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("FIled Name")
if (issue.getCustomFieldValue(cs) == null) {
// throw error
}
Thanks Alexey.
I have this code.
def browse = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Can you browse the Internet?")
if (vpnproblemtype == "It's a VPN issue"){
if (issue.getCustomFieldValue(browse) == null){
throw new InvalidInputException("browse", "Field empty")
}
}
The code is running well. But I can't see the error message in the Service desk customer portal. Do you jnow how to display a message in the customer portal?
thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I never tried validators for portals. Anyway I would make sure that your code throws the error by adding logging.
def browse = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Can you browse the Internet?")
if (vpnproblemtype == "It's a VPN issue"){
if (issue.getCustomFieldValue(browse) == null){
log.error("error logged")
throw new InvalidInputException("browse", "Field empty")
}
}
Could you have a look in the atlassian-jira.log if the error message is printed out?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
throw new InvalidInputException("Field empty")
without the field is working. but I need to send the error message to the fied. I'm tried without the quotation mark. but The message is doesn't show
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello everyone! We are very excited to announce some much needed changes to the issue create experience in JSM (the blue "create" button) at the top of the screen. We have just starte...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.