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

Issue Picker field will validate the existing value after user fill-in new issues cause JQL error


    • Type: Bug
    • Status: Triage
    • Priority: Low
    • Resolution: Unresolved
    • Affects Version/s: 6.9.1
    • Fix Version/s: None
    • Component/s: Scripted Fields
    • Labels:
    • Critical Points:


      Steps to reproduce the problem

      1. Create two issue picker fields named as Story SR (single select) and Bug SR (multi-select)
      2. Story SR field with JQL query = "type = Story"
      3. Bug SR field with JQL query = "type = Bug and 'Story SR' is not empty"
      4. Add Bug field into the "In Progress" workflow screen.
      5. In the "In Progress" transition, add the following script into the post-function to update the Story SR value on the added issue:
        import com.atlassian.jira.component.ComponentAccessor
        import com.atlassian.jira.issue.CustomFieldManager
        import com.atlassian.jira.issue.Issue
        import com.atlassian.jira.issue.MutableIssue
        import com.atlassian.jira.issue.changehistory.ChangeHistoryManager
        import com.atlassian.jira.issue.fields.CustomField
        import com.atlassian.jira.issue.history.ChangeItemBean
        import com.atlassian.jira.issue.ModifiedValue
        import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
        import com.atlassian.jira.issue.index.IssueIndexingService
        import org.apache.log4j.Logger
        import org.apache.log4j.Level
        CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
        ChangeHistoryManager changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
        CustomField storySr = customFieldManager.getCustomFieldObject(10536L) //story sr field
        CustomField taskCustomField = customFieldManager.getCustomFieldObject(10538L) //bug sr field
        List history = changeHistoryManager.getChangeItemsForField(issue, taskCustomField.getFieldName())
        def iis = ComponentAccessor.getComponent(IssueIndexingService)
        List tasks = (List) issue.getCustomFieldValue(taskCustomField)
        for(MutableIssue task : tasks) {
            task.setCustomFieldValue(storySr, issue)
            storySr.updateValue(null, task, new ModifiedValue(null, issue), new DefaultIssueChangeHolder())
      1. Create a new Story issue and two Bug issues.
      2. Go to the Story issue and transit to In Progress. Add some bug issues into the Bug SR issue picker field. You will notice the issue that added has their Story SR issue picker field updated.
      3. Go back to the In Progress transition and repeat the same thing by adding some bug issues into the Bug SR issue picker. Then, performed a project reindexing.
      4. Create a new Bug issue and add this issue into the Bug SR issue picker field on the first Story issue. You will hit the "Issue: AA-XX does not fit filter query: type = 'Bug' and "Story SR" is empty" error message.

      Demo - Screen Recording 2020-10-19 at 3.24.27 PM.mp4


      Remove the 'Story SR' is not empty from the JQL query.




            jloong John Chin Loong
            1 Vote for this issue
            2 Start watching this issue