Need to restrict/block the Move operation when client defect is being moved to different Issue type

Likhita October 1, 2024

Hi All,

We have a requirement, Currently client defects can be moved to other issue types like story, task etc. But this needs to be restricted as client defects can only be moved to client defects. Tried with validators but Jira's native Move functionality will bypass all the validators and condition.

Note:- can't disable the "Move" option as it will block the movement from client defect to client defect.

Can anyone provide with this requirement any solution or suggestion will be helpful ..

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Manoj Gangwar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 1, 2024

Hi @Likhita are you using the same workflow for all the issue types? 

Likhita October 1, 2024

Hi @Manoj Gangwar 

Thanks for the reply. We have been configured different workflows each issue type.

Manoj Gangwar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 1, 2024

If you have scriptrunner plugin then it is feasible. 

 

Likhita October 1, 2024

Yes we do have script runner plugin.

Manoj Gangwar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 1, 2024

To restrict or block the move operation when a client defect is being moved to a different issue type using ScriptRunner, you can create a custom listener that checks the issue type during the move operation. Here's how you can set this up:

 

  • Go to ScriptRunner:

    • In your Jira instance, navigate to Administration > Add-ons > ScriptRunner.
  • Create a New Listener:

    • Go to Listeners under the ScriptRunner menu.
    • Click on Create Listener.
  • Configure the Listener:

    • Name: Give your listener a descriptive name (e.g., "Restrict Move for Client Defects").
    • Events: Select the event type Issue Updated (as the move operation updates the issue).
  • Add Conditions:

    • In the Script section, add the following Groovy script:
      import com.atlassian.jira.component.ComponentAccessor
      import com.atlassian.jira.issue.Issue
      import com.atlassian.jira.issue.IssueManager
      import com.atlassian.jira.issue.issuetype.IssueType

      def issueManager = ComponentAccessor.getIssueManager()
      def issue = event.issue

      // Check if the issue type is "Client Defect"
      if (issue.issueType.name == "Client Defect") {
      // Get the change history to see if issue type was changed
      def changeItems = event.changeLog?.getRelated("ChildChangeItem")

      changeItems?.each { changeItem ->
      if (changeItem.field == "Issue Type" && changeItem.toString != "Client Defect") {
      // Block the move and log a message
      throw new RuntimeException("Client defects cannot be moved to a different issue type.")
      }
      }
      }

      Save the Listener:

      • Once you’ve added the script, save the listener.

 

Likhita October 1, 2024

Sure , will try it and get back.

Likhita October 1, 2024

I tried the same, but still it converted into selected issue type.

TAGS
AUG Leaders

Atlassian Community Events