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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,559,898
Community Members
 
Community Events
185
Community Groups

How to find all the projects using default field configuration?

Edited

Hello,

How to find all the projects using default field configuration's of a custom field?

Any sort of help is appreciated. 

Thanks,

Kiran.

 

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.fields.ConfigurableField;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.config.FieldConfigScheme;
import com.atlassian.jira.issue.fields.config.manager.FieldConfigSchemeManager;
import com.atlassian.jira.issue.fields.FieldManager;
import com.atlassian.jira.issue.context.ProjectContext;
import com.atlassian.jira.issue.context.JiraContextNode;
import org.apache.log4j.Logger;
import org.apache.log4j.Level;
def log = Logger.getLogger("test.connector")
log.setLevel(Level.DEBUG)


CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
FieldConfigSchemeManager fieldConfigSchemeManager = ComponentAccessor.getFieldConfigSchemeManager();
FieldManager fieldManager = ComponentAccessor.getFieldManager();

def customfield = fieldManager.getCustomField("customfield_26238")
def projects_using = customfield.getConfigurationSchemes()
def projects = customfield.getAssociatedProjectObjects()
log.debug(projects_using)
for(int i=0;i<projects_using.size();i++){
log.debug(projects_using[i].getName())
log.debug(projects_using[i]. getAssociatedProjectIds())
}

 

The above is working only for the projects which have their separate context. 

Output:

2018-06-04 20:04:32,038 DEBUG [test.connector]: [com.atlassian.jira.issue.fields.config.FieldConfigSchemeImpl@5174eeeb, com.atlassian.jira.issue.fields.config.FieldConfigSchemeImpl@25f2efc1, com.atlassian.jira.issue.fields.config.FieldConfigSchemeImpl@2d65b11c]

2018-06-04 20:04:32,038 DEBUG [test.connector]: Default Configuration Scheme for 911 Flow Completed?

2018-06-04 20:04:32,038 DEBUG [test.connector]: []

2018-06-04 20:04:32,038 DEBUG [test.connector]: Phone Launches

2018-06-04 20:04:32,038 DEBUG [test.connector]: [21209, 22015]

2018-06-04 20:04:32,038 DEBUG [test.connector]: Kiran Test

2018-06-04 20:04:32,038 DEBUG [test.connector]: [11204]

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events