Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Set a Jira custom field with the attribute value from a selected object - Condition

We use "Set a Jira custom field with the attribute value from a selected object" post function in a workflow. We need to have a condition based of the values of select list field. Ca you give me an example?

Thank you,

Anna

1 answer

0 votes
Hana Kučerová Community Leader Nov 26, 2020

Hi @Anna Protopapa ,

for example this one. It is expected that true or false value is returned to determine, it the post function should be executed or not.

Thank you for the answer. I am looking for the code of the condition to be based of the values of select list field and not on an insight insight custom field.

Hana Kučerová Community Leader Dec 20, 2020

Hi @Anna Protopapa ,

I assume your field has "Select List (single choice)" type. Then you can use something like this - if in custom field with id 12345 option with value "Your Value" is stored, the post function will be executed:

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

Long customFieldId = 12345
String customFieldValue = "Your Value"

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
CustomField customField = customFieldManager.getCustomFieldObject(customFieldId)
Option customFieldOption = issue.getCustomFieldValue(customField) as Option
return customFieldOption?.getValue() == customFieldValue

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
Community showcase
Published in Jira Service Management

Why upgrade to Jira Service Management Premium?

We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan.  &nb...

133 views 0 4
Read article

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