Hi Friends,
I am trying to hide one Issue type via Script Runner Behaviours Plugin. Same script i used for other project it's working, but on this project is not working. Please help
@Dominic Lagger @Nic Brough -Adaptavist-
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
import static com.atlassian.jira.issue.IssueFieldConstants.ISSUE_TYPE
def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)
def allIssueTypes = ComponentAccessor.constantsManager.allIssueTypeObjects
def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issueTypeField = getFieldById(ISSUE_TYPE)
def projectManager = ComponentAccessor.projectManager
def availableIssueTypes = []
def allProjects = projectManager.getProjects()
def projectRoles = projectRoleManager.getProjectRoles(user, issueContext.projectObject)*.name
if(projectRoles==["Administrators"] || projectRoles== ["User"] || projectRoles== ["Developers"] || projectRoles==["Business Analysts"] || projectRoles==["Developers"]){
availableIssueTypes.addAll(allIssueTypes.findAll { (it.name != "Ad Hoc Request_OLD" ) && (it.name != "Ad Hoc Request MP" ) && (it.name != "Ad Hoc Request QOL" ) && (it.name != "Ad Hoc Tasks" ) })
}
else {
availableIssueTypes.addAll(allIssueTypes.findAll {(it.name != "Bug" ) && (it.name != "Task") })
}
issueTypeField.setFieldOptions(availableIssueTypes)
Hi Vikrant,
If the script is working for one project and not another project then this indicates that either the configuration for the behavior is invalid or that an error occurred.
In order to help yourself to troubleshoot the issue, I would advise that you look at the following items below.
1. Check the mapping for the behavior script as described here to ensure that is actually mapped to the project where it is not running on as the script will only run for projects that it is mapped for.
2. I would advise enabling logging for behaviors as mentioned here and then to re run the behavior and to re produce it not working and then to check the atlassian-jira.log file to see if this gives any errors related to the behaviors script.
I hope this information helps.
Regards,
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.