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

Getting a project's field configuration scheme id with script runner

Deleted user October 8, 2015

I'm trying to limit what a workflow will do based on how projects are configured. We have two different Field Scheme Configurations (one contains certain requirements while the other doesn't). I'd like to check which field config an issue's project is using and then validate the workflow based on that.

Given an issue, I know I can access the issue's project with issue.projectObject?.name or issue.projectObject?.key

How can I pull additional project information out of that? For instance the field configuration scheme ID or name. I tried searching the API docs, but wasn't sure where to look.

Thanks!

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Deleted user October 16, 2015

Figured it out! If anyone else is looking for something similar, here is my code:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.fields.layout.field.FieldLayoutManager
import com.atlassian.jira.issue.fields.layout.field.FieldConfigurationScheme

// This is used in a validator script. 
 
FieldLayoutManager fieldLayoutManager = ComponentAccessor.getComponent(FieldLayoutManager)
FieldConfigurationScheme scheme = fieldLayoutManager.getFieldConfigurationScheme(issue.projectObject)


log.debug("FieldConfig: " + scheme.getName() + " and id: " + scheme.getId())
TAGS
AUG Leaders

Atlassian Community Events