How to validate multiple choice field value was selected and user picker field is null?

Hi,

Need to validate for the below scenarios

 

 

image2017-3-1 12:21:7.png

When I select "Feature Note" value from Documentation (multiple choice field) and Feature Note Developer (user picker field) is null, then I need to show Feature Note Developer is required validation message.

When I select other than Feature Note value Feature Note Developer is not required. I mean it should proceed transtion.

I tried some possible ways but it didnt work.

Any help would be apprecited.

Thanks

1 answer

It should be like this:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.issue.fields.CustomField

Issue issue
CustomField documentation = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Documentation")

for(Option option: ((List<Option>) issue?.getCustomFieldValue(documentation))){
    if(option.getValue().equals("Feature Note")){
        CustomField developer = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Feature Note Developer")
        return issue.getCustomFieldValue(developer) != null
    }
} 

return true

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,104 views 13 19
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot