Workflow Condition based on customfield value

Björn Thebbe February 19, 2017

Hello everybody,

we have a custom field and want to start a review based on the content. A check that only starts when a specific value is in the custom field. How can I achieve this?

 

Thank you very much.

4 answers

1 accepted

0 votes
Answer accepted
Björn Thebbe February 20, 2017

I tried to write an Buil-in script but it doesnt work. Do you have any idea what is wrong?
I can close the issue without one of the conditions being met.

 

import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()

def kategorie = customFieldManager.getCustomFieldObjectByName("Kategorie")
def wirtLage = customFieldManager.getCustomFieldObjectByName("Wirtschaftliche Lage")
def zufrScan = customFieldManager.getCustomFieldObjectByName("Kundenzufriedenheit")
def zufrMita = customFieldManager.getCustomFieldObjectByName("Kundenzufriedenheit Mitarbeiter")

kategorie == "Telefongespräch" || ( zufrMita != null && zufrScan != null && wirtLage != null)

 

Alexey Dorofeyev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 20, 2017

You are performing checks on a field itself, not on it's value.

Try something like this (not tested):

import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()

def kategorie = customFieldManager.getCustomFieldObjectByName("Kategorie").getValue(issue)
def wirtLage = customFieldManager.getCustomFieldObjectByName("Wirtschaftliche Lage").getValue(issue)
def zufrScan = customFieldManager.getCustomFieldObjectByName("Kundenzufriedenheit").getValue(issue)
def zufrMita = customFieldManager.getCustomFieldObjectByName("Kundenzufriedenheit Mitarbeiter").getValue(issue)

kategorie == "Telefongespräch" || ( zufrMita != null && zufrScan != null && wirtLage != null)

Anyway, you don't need any coding to resolve your problem. Look at this:

https://confluence.atlassian.com/adminjiraserver072/advanced-workflow-configuration-828787971.html

Björn Thebbe February 20, 2017

Good morning John,

thank you i will test you solution and link.

Björn Thebbe February 20, 2017

Hi John,

thank you very much for your help. The grouping works perfectly. I did not know this possibility so far.

Have a nice day.

Björn

Alexey Dorofeyev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 20, 2017

Hi Björn!

Please mark my comment as accepted answer smile 

1 vote
Alexey Dorofeyev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 19, 2017

I think this can be done using Suite Utilities plugin.

It adds workflow condition that checks value in custom field.

0 votes
Björn Thebbe February 20, 2017

Okay thank you. I will check this

0 votes
Björn Thebbe February 19, 2017

Yes that´s true but we need a combination of conditions:

The user can close the issue:

if Customfield 1 = "Mobile" or

if Customfield 2 is not null
and Customfield 3 is not null
and Customfield 4 is not null

 

Alexey Dorofeyev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 20, 2017

You can combine conditions in JIRA built-in workflow transition editor

Suggest an answer

Log in or Sign up to answer