Uploaded image for project: 'SR for Jira - Development'
  1. SR for Jira - Development
  2. SRJIRA-2788

Issue Type Field does not respond to setFormValue or setRequired (etc) in Behaviours

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Done
    • High
    • Resolution: Fixed
    • 5.3.9
    • 5.4.34
    • None
    • None
    • Sprint 38 - Next
    • 0

    Description

      Tested in 5.3.9, Issue Type Field is not able to be modified in the normal way (setFormValue, setRequired, etc.), while other fields work as expected. 

      Code used to test: 

       

      import com.atlassian.jira.component.ComponentAccessor
      import com.atlassian.jira.security.roles.ProjectRoleManager
      import static com.atlassian.jira.issue.IssueFieldConstants.ISSUE_TYPE
      // if the current user is in the Users role only, set the issue type to "Query", and lock it
      def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)
      def user = ComponentAccessor.jiraAuthenticationContext.user
      def remoteUsersRoles = projectRoleManager.getProjectRoles(user, issueContext.projectObject)*.name
      log.error (remoteUsersRoles)
      log.error(remoteUsersRoles.contains("Administrators"))
      if (remoteUsersRoles.contains("Administrators")) {
       def constantsManager = ComponentAccessor.getConstantsManager()
       def queryIssueType = constantsManager.getAllIssueTypeObjects().find { it.name == "Story" } 
       def issueTypeField = getFieldById(ISSUE_TYPE)
       log.error ("Query Issue Type " + queryIssueType)
       log.error ("Issue Type Field " + issueTypeField)
       issueTypeField.setFormValue(queryIssueType.id)
       issueTypeField.setLabel("THIS WORKED")
      }
      

       

      Attachments

        Issue Links

          Activity

            People

              ahasan Ashraful Hasan [X] (Inactive)
              nriley Neal Riley
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: