Hi guys,
I need help. We have a requirement to set priorities based on the issue type. We are using the JIRA Server 8.20.12 version now. I have written this below code for the Task issue type. It's working fine on the Create screen But not on the edit screen. Can u help me to find a solution for this?
import com.atlassian.jira.component.ComponentAccessor
import static com.atlassian.jira.issue.IssueFieldConstants.PRIORITY
def constantsManager = ComponentAccessor.getConstantsManager()
def formField = getFieldById(PRIORITY)
def availablePriorities = ["High","Low"]
if(issueContext.issueType.name == "Task")
{
formField.setFieldOptions(availablePriorities)
}
Out of the box, you can set priority scheme at the project level in the Server env. However, the scheme is for the entire project and cannot be based on issue types used within a project.
To set priority at issue type + only in the EDIT screen, you will need to use third party paid add-on to accomplish the ask - Example Scriptrunner for Jira and utilize their Behavior component setup -
https://marketplace.atlassian.com/apps/6820/scriptrunner-for-jira?hosting=datacenter&tab=overview
NOTE - I hope you have already migrated to Data Center env and not staying with the Server env, it is because the Server env support will end at Feb, 2024.
Hope this helps.
Best, Joseph Chung Yin
Jira/JSM Functional Lead, Global Technology Applications Team
Viasat Inc.
I had this same issue. I ended up adding the issue type field to screen and hiding it with the behavior. You just have to remember to have this as well so that the field shows on the create screen:
import static com.atlassian.jira.issue.IssueFieldConstants.ISSUE_TYPE
def issueTypeField = getFieldById(ISSUE_TYPE).setHidden(true)
if (!underlyingIssue){
issueTypeField.setHidden(false)
}
Although I couldn't get the priority field to set the options the same way as this. Maybe it changed. I'm on Data Center version 9.16.1.
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.