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

Next challenges

Recent achievements

Recognition

  • Give kudos
  • My kudos

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

Can I do a post function to map certain custom field values to a single field?

I want to create a custom field for "Content Type" that is of field type: checkboxes. When people select their content type, I would like to run a post function in my workflow to assign a component. So, for example, if content types "Digital Ad" or "Print Ad" are selected, I would like the post function to select the component "Advertising"

 

Is this possible?

1 answer

Yes, this is possible.

For the checkbox, see Adam's answer: https://community.atlassian.com/t5/Jira-Core-questions/How-to-get-checkbox-value-with-scriptrunner-in-post-function/qaq-p/278604

For the component setting:

import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.component.ComponentAccessor

// you will probably end up just using 'issue' as provided by the post function script
MutableIssue issue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("NPB-3")
def pId = issue.getProjectObject().getId()
def component = ComponentAccessor.getProjectComponentManager().findByComponentName(pId,"test")
issue.setComponent([component])

 

Then of course you will have to add in your logic. But this should get you started.

Thank you for your response.  I am a little confused. Do I have to write code to accomplish this? Is it not something I can do using the Jira configuration?

Yes, I believe so. The above example requires ScriptRunner for JIRA.

There could be other add-ons that can accomplish this but I'm not aware of them.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

3,996 views 11 5
Join discussion

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