Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

URL field workflow validator based on checkbox


Hi, I'm trying to set up a validation in a workflow that requires the URL field [RCA] to be filled when closing a ticket, but only when the radio button field [RCA requested] has the value "Yes".

Can someone tell me what I'm doing wrong here? Instead of only requiring [RCA] under that condition the field is always required, even if it has a value. Alternately should I use the JWT logical validator?


import com.atlassian.jira.issue.customfields.option.Option

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cf = customFieldManager.getCustomFieldObjectByName("RCA requested")

cfValues['RCA requested']?.value != 'Yes' || cfValues['RCA']

Screen Shot 2021-11-30 at 2.00.16 PM.png 

2 answers

1 accepted

1 vote
Answer accepted

Hey @Alex Smith

I just wanted to get back to you to explain the identical implementation with Jira Workflow Toolbox's Logical Validator. The choice of the validator would be the right one. 😁 👍🏼

The expression is written just as quickly:

%{issue.cfAAAAA} = "Yes" IMPLIES %{issue.cfBBBBB} != null

With the checkbox checked and no URL, the query will return false. The validator returns true in any other case (both fields are empty or URL filled without the checkbox). Have fun enhancing your workflows! :)

Best, Max

Hi @Max Foerster - Decadis AG thank you so much! That's perfect, as we do have JWT. I simply couldn't figure out the syntax

0 votes
Alex Koxaras Community Leader Nov 30, 2021

Hi @Alex Smith 

I've used the following code to one of my project and it worked:

import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cf = customFieldManager.getCustomFieldObjectsByName("NDA")

cfValues['NDA']?.value != 'Signed' || cfValues['NDA link']

Replace NDA with your single select field and the NDA link field with your RCA link. The condition worked when NDA was equal to "signed" (your "Yes), and I couldn't proceed to the next transition.

Interestingly that only partially worked, at it was only successful when I set the radio button field [RCA requested] as == instead of != (which makes little to no sense). But then it required the URL field [RCA] whether the field value was "Yes" or it was empty. Maybe I need to add a second value to [RCA requested] and make it required no matter what.

cfValues['NDA']?.value == 'RCA requested'

My apologies, [RCA requested] is a checkbox field instead of radio buttons. Any suggestions if that might be causing the issue? Ultimately the field can either have the value "Yes" or it can be empty, and I only want the URL field [RCA] required when the value filled in with the only option of "Yes". Thanks.

Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you