Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Welcome to the documentation of tutorials teaching writing Groovy scripts in the Jira MISC Workflow Extensions plugin. This documentation has tutorials that help you in writing simple to complex Groovy scripts in the JMWE add-on.

By the end of this tutorial, you will have a local Jira Server instance with workflow extensions having scripts.

Note

Note that the end product is not a complete functional workflow.

About the tutorial

This tutorial guides you through the following chapters:

Child pages (Children Display)

  • Prepare the environment
    • Jira 7.0.0
    • Install JMWE
    • Workflow to experiment with Groovy in JMWE
    • Create a Task Management Workflow
      • Create a Project Lead
      • Create a custom field "User who made the transition"
      • Create one issue
      • Create a linked issue
      • Create a subtask
    • Assign the issue to the Project lead if the priority of the ticket is High or Critical
      • Add Set field value pf
      • Select the value as PL
      • Add CE - issue.get("priority").getName() == "High" or issue.get("priority").getName() == "Critical"
    • Store the author of the transition
      • Add the Set field value pf
      • Select the custom field
      • Add GE - currentUser
    • Save the workflow. 
    • Remove JMWE post-function
    • Save it and share the XML
  • Tutorial - My first Groovy script
    • Fetch the key of the issue
    • issue.getKey()
    • Provide reference to the issue variable and the getKey() method
    • What do you get as the output - Refer the expected value of each field type document.
    • What can I do with this Groovy script result? - that is a String
      • Either add this as a comment/Set a field that expects a String as input.
  • Tutorial - How to write a condition - The result of a scripted condition is a boolean. It can be used either to Control the execution of a post-function or Control the availability of a condition or Validate the input during a transition.
    • Simple condition - Check whether a text field is empty or not
      • issue variable - Reference to variables documentation
      • Standard field, Access standard field doc reference
      • Custom field,  Access custom field doc reference
      • Compare the value to the required value
        • Use if() or
        • Optimize the code by returning the result of the comparison
    • Check the current user is a specific user
      • currentUser is the variable. - Reference to variables documentation
      • Explain its return value, and how to get the name of the user. -  Reference to User interface
      • Return the result of the comparison to the specific username
    • Check the priority of the issue
      •  issue variable - Reference to variables documentation
      •  Standard field - Expected input type of this field - Refer expected field type document
      •  Issue interface - getPriorityObject() or get("priority")
      •  Priority interface - getName()
      • Standard field, Expected field type - Check the priority - Priority object
      • Since it is an object, it has properties to look up to
      • Priority interface- refer
  • Tutorial - Safe access a field - To explain on how to avoid null pointer exceptions
  • Tutorial - How to return a simple value - 
  • Tutorial -