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?
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:
// 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")
Then of course you will have to add in your logic. But this should get you started.
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 ...
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