Hi,
Is there some example of how i can add Field screens programatically in a plugin?
I want to add new screen with a lot of custom field for workflow transition in my plugin and when I change status, it will be displayed. I can not find any example of how to do this.
I am new to JIRA dev so would welcome some examples thank you in advance
Hi Jayce,
Welcome to the community! I think you can have a look at FieldScreenManager and FieldScreenFactory. Not actually tried but something like this might work:
FieldScreenManager fieldScreenManager;
FieldManager fieldManager;
FieldScreen newScreen = fieldScreenFactory.createScreen();
newScreen.setName("My new screen");
FieldScreenTab newTab = newScreen.addTab("New tab");
Field myField = fieldManager.getField("customfield_10000");
newTab.addFieldScreenLayoutItem(myField.getId());
newScreen.store();
Thanks Kubilay!
I added new Screen in my plugin. I'm trying to add it into a transition of workflow, but it doesn't work. Can you help me to check this code below?
MutableIssue issue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("TP-1");
WorkflowManager workflowManager = ComponentAccessor.getWorkflowManager();
JiraWorkflow workflow = workflowManager.getWorkflow(issue);
Collection<ActionDescriptor> allActions = workflow.getAllActions();
Map<String, String> metaAttributes=new HashMap<String, String>();
metaAttributes.put("jira.fieldscreen.id", newScreen.getId().toString());
for(ActionDescriptor aActions : allActions){
if(aActions.getName().equals("Plan")){
aActions.setView("Waiting to test");
aActions.setMetaAttributes(metaAttributes);
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.