Versions Compared

Key

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

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

This section has use cases which help you in understand the usage of Post-functions provided by JMWE.

On this page:

Table of Contents
maxLevel4

Assign to role member

This post function can be used to assign an issue to the member of a selected project role

Sample use cases:(lightbulb)

(lightbulb) On the creation of a Bug assign it to a user only if he is a Product Owner

Expand
titleSteps


Panel
  • Add the Assign to role member to the Create transition.

  • Select Product Owner as the Project Role

  • Select Use selected assignee, only if a member of the required role option

...


(lightbulb) Assign an issue to a member of the QA team when the issue is transitioned to Ready for testing status

panel
Expand
titleSteps


  • Create a QA project role, with the testers as its members.

  • Add the Assign to role member post-function to the transition that leads to Ready for testing status.

  • Select QAas the project role to look for.



Click here to know the post-function features

...

This post function can be used assign an issue to the last role member of a selected project role. This is very much similar to the Assign to role member, except that it always looks for the last role member.

Sample use cases:(lightbulb)

(lightbulb) When a tester reopens an issue assign the issue to a Developer who last worked on it.

panel
Expand
titleSteps


  • Create a Developer project role, with the developers as its members.

  • Add the Assign to last role member to the Reopen transition.

  • Select Developer as the Project Role

...


(lightbulb) After testers have validated an issue, it should be assigned to the last product owner who worked on it for the functional validation. The product owner might either have been explicitly assigned to the issue before, to write the functional specification or have written the specification while creating the issue.

panel
Expand
titleSteps


  • Create a Product Owner project role, with the product owners as its members.

  • Add the Assign to last role member post-function to the Validate transition of the workflow.

  • Select Product Owner as the project role to look for.

  • Select Include Reporter option in case a product owner created the issue but was never assigned to it afterward.



Click here to know the post-function features

Clear field value

(lightbulb) Clear the Fix Version/s field on the reopening of a ticket.

Expand
titleSteps


Panel
  • Add the Clear field value post-function to the Reopen transition of the workflow.

  • Select the field Fix Version/s to from Field.



Clear field of related issues

This post-function clears the value of the selected field(s) of the issue's related issues (such as linked issues, Stories of an Epic, Epic of a Story, subtasks of an issue, issues returned by a Groovy script or a JQL search, etc.)

(lightbulb) Clear a set of fields on all the linked issues of the current issue when an Abort is triggered on the current issue

Expand
titleSteps


Panel
  • Add the Clear field value of related issue post-function to the Abort transition of the workflow.

  • Select Issues linked to the current issue through any link type from Which Issue(s)

  • Select all the fields to be emptied from Field.



Comment issue

This post-function can be used to comment an issue either by using a Raw value or the result of a Groovy expression or aGroovy template.

Sample use cases:(lightbulb)

(lightbulb) A customer using Jira Service Desk should be notified via a comment when someone has started working on their support request.

Expand
titleSteps


Panel
  • Add the Comment issue post-function to the Start Progress transition.

  • Select the Comment type as Groovy template

  • Write the following content in the Comment section:

    Code Block
    languagegroovy
linenumberstrue
  • We have started working on your support request - $issue.key. We will get back to you within 24 hours.

...



(lightbulb) On resolving or closing the issue, comment the issue with a summary of the worklog.

paneltrue
Expand
titleSteps


  • Add the Comment issue post-function to the Start Progress transition.

  • Select the Comment type as Groovy template

  • Write the following content in the Comment section:

    Code Block
    languagegroovy
linenumbers
  • <% def count = 1 
    issue.get("worklog").each(){
      print "Worklog "+ count + "\n" + " Started :" + it.getStartDate() + "\n" + " Time Spent :" + it.getTimeSpent() + "\n" + " Work Description :" + it.getComment() + "\n"
      count = count + 1
    }%>




Click here to know the post-function features

Comment related issues

This post-function creates a comment on all issue's related issues (such as linked issues, Stories of an Epic, Epic of a Story, subtasks of an issue, issues returned by a Groovy script or a JQL search, etc.). The  The text of the comment can comment can be either a text, optionally including a Groovy template markup, or the result of the evaluation of a Groovy expression.

Sample use cases:(lightbulb)

(lightbulb) An issue is blocking another and you want to ensure the Assignee of the blocked issue is notified when the impediment has been resolved.

paneltrue
Expand
titleSteps


  • Add the Comment related issues post-function to the transition that resolves the current issue.

  • Select Issues linked to the current issue through the following link type under Which Issue(s)

  • Choose the issue link type blocks 

  • Select the Comment type as Groovy template

  • Write the following content in the Comment section.

    Code Block
    languagegroovy
linenumbers
  • The impediment $issue.key- $issue.summary has been resolved.

...



(lightbulb) Add a comment on all the sub-tasks when the parent is cancelled

paneltrue
Expand
titleSteps


  • Add the Comment related issues post-function to the Cancel transition

  • Select the Comment type as Groovy template

  • Select Sub-tasks of the current issue under Which issue(s)

  • Write the following content in the Comment section.

    Code Block
    languagegroovy
linenumbers
  • The parent of the issue i.e $issue.key has been canceled.

...



(lightbulb) On the Approval of an issue, copy the comment added if any to its sub-tasks.

paneltrue
Expand
titleSteps


  • Add the Comment related issues post-function to the Approve transition

  • Select the Comment type as Groovy template

  • Select Sub-tasks of the current issue under Which issue(s)

Write
  • Write the following content in the Comment section.

    Code Block
    languagegroovy
linenumbers
  • if(transientVars.comment)
      return transientVars.comment
    else
      return ""


  • Move this post-function after the "Add a comment to an issue if one is entered during a transition" post-function.

...


(lightbulb) The Service Desk Agent responsible for a support request should be notified when the linked Bug is resolved.

panel
Expand
titleSteps


  • Add the Comment related issues post-function to the Resolved transition of the Bug workflow.

  • Select the Comment type as Groovy template

  • Select Issues linked to the current issue through the following link type under Which Issue(s)

  • Choose the issue link type blocks  

  • Write the following content in the Comment section.

    Code Block
    $issue.key has been resolved. You should get back to the customer.


  • Check the Restrict to internal (Jira Service Desk only) option to make sure the customer doesn't see the comment.



Click here to know the post-function features

...

This post-function can be used to create a new issue.

Sample use cases:(lightbulb)

(lightbulb) On the approval of a Story, create two sub-tasks: one for Development and another for QA.

panel
Expand
titleSteps


  • Add the Create/Clone issue post-function to the transition Approve of the Story workflow to create a QA ticket.

  • Select Same as current issue from the Project field.

  • Select Subtask from the Issue type field.

  • Select Current issue from the Parent issue field.

  • Add a Summary

    Code Block
    Task for <%=it%>


  • Select the option under "Multiple issue creation"

  • Input the following value:

    Code Block
    ["Development","QA"]


Two sub-tasks will be created, one for "Development" and another for "Subtask"

...


(lightbulb) Create a bug in Project B when the developer confirms a Bug in Project A for the component UI

panel
Expand
titleSteps


  • Add the Create/Clone issue post-function to the Start Progress transition of the Bug workflow.

  • Select the

Production project from
  • Production project from the Project field.

  • Select Bug from the Issue type field.

  • Set Summary field to $issue.summary

  • Set Linked Issues field to be copied from the current issue

  • Select is cloned by in the Link to new issue section.

  • Select the Conditional execution section and write the following script:

    Code Block
    issue.get("components").any{it.name == "UI"}

...



(lightbulb) To onboard a new employee in the HR database, create tasks one for each value selected in "Onboarding Tasks" multi-valued field

panel
Expand
titleSteps


  • Add the Create issue post-function to the transition Create of the New Employee ticket workflow.

  • Select Same as current issue from the Project field.

  • Select Task from the Issue type field.

  • Select the link type from the main issue to the new issues under "Link type"

  • Edit the Summary field value to:

    Code Block
    Task for <%=it.value%>


  • Select the option under "Multiple issue creation"

  • Input the following value:

    Code Block
    issue.get("Onboarding Tasks")

...



panel
Expand
titleSteps


  • Add the Create

issue 
  • issue post-function to the Reopen transition of the sub-task workflow.

  • Select the project from Project

  • Select the Bug in Issue type

  • Select is caused by in Link to new issue

  • Select the Epic Link field in Set fields of new issue.

  • Select the Value type as Groovy expression

  • Write the following in the Value section

    Code Block
    if(issue.getLinkedIssues('is caused by'))
    {
      issue.getLinkedIssues('is caused by').first().getParentObject().get("Epic Link")
    }




Click here to know the post-function features

...

This post-function sets the value of a field to the value of a field in related issues (such as linked issues, Stories of an Epic, Epic of a Story, subtasks of an issue, issues returned by a Groovy script or a JQL search, etc.)

Sample use cases:(lightbulb)

(lightbulb) Copy the Fix Version/s field from the Epic to a Story, while creating a Story.

panel
Expand
titleSteps


  • Add the Copy field value from related issues post-function to the Create transition of the Story workflow.

  • Select Fix Version/s in Source Field.

  • Select Same as the source field in Destination Field.

  • Choose Issues that belong to the current Epic from Which Issue(s)



Click here to know the post-function features

...

This post-function copies the value of a field to all related issues (such as linked issues, Stories of an Epic, Epic of a Story, subtasks of an issue, issues returned by a Groovy script or a JQL search, etc.)

Sample uses cases:(lightbulb)

(lightbulb) Copy the Fix Version/s field from the Stories to Epic, after resolving a user story.

panel
Expand
titleSteps


  • Add the Copy field value to related issues post-function to the Resolve transition of the Story workflow

  • Select Fix Version/s in Source Field.

  • Select Same as the source field in Destination Field.

  • Choose Epic of the current issue from Which issue(s).

  • Check Add source value(s) to destination field option.



Click here to know the post-function features

...

This post-function can be used to set the value(s) of a selected field with value(s) from the same field of an issue's parent issue.

Sample use cases:(lightbulb)

(lightbulb) When creating a child bug of another bug (i.e. the parent bug), copy the fields Assignee, Component/s and Affects Version/s if they are left empty.

panel
Expand
titleSteps


  • Add the Copy field value from parent issue post-function to the Create transition of the sub-task workflow.

  • Select Assignee in Field.

  • Select Copy only if not set option.

  • Repeat the above steps for the Component/s and Affects Version/s fields.



Click here to know the post-function features

...

This post-function can be used to copy the value(s) of a selected field to the same field of the issue's parent issue.

Sample use cases:(lightbulb)

(lightbulb) Copy the labels from each sub-task to its parent when the sub-task is closed.

panel
Expand
titleSteps


  • Add the Copy field value to parent issue post-function to the Close transition of the Sub-task workflow.

  • Select Labels in Field.

  • Select the Add source value(s) to destination field option.



Click here to know the post-function features

...

This post-function can be used to copy the value(s) of one field to another field of the same issue.

Sample use cases:(lightbulb)

(lightbulb) Set the component of an issue with a value selected from a cascading field that carries the Main and Sub-components in parent and child.

panel
Expand
titleSteps


  • Add the Copy value from field to field post-function to the Create transition of the issue workflow.

  • Select the Cascading field as the Source field.

  • Select the Components field as the Destination field.

  • Select Return "parent - child" for cascading custom fields option.

Note: The Component name should be in Component - Subcomponent format.

...


(lightbulb) Issues in our project are fixed in the version they are found. So I want to copy the Affects Version/s of the issue to the Fix Versions, on resolving the issue.

panel
Expand
titleSteps


  • Add the Copy value from field to field post-function to the Resolve transition of the issue's workflow.

  • Select Affects Version/s as the Source field.

  • Select Fix Version/s as the Destination field.

...


(lightbulb) I want 'Capture for JIRA Environment' field to be copied to the 'Environment' field when a bug is created using Capture for JIRA.

panel
Expand
titleSteps


  • Add the Copy value from field to field post-function to the Create transition of the Bug workflow.

  • Select Capture for JIRA Environment as the Source field.

  • Select Environment as the Destination field.

...


(lightbulb) Copy value from a Single Version Picker select list to the Fix Version(s) field if the resolution provided while closing the issue is "Fixed".

panel
Expand
titleSteps


  • Add the Copy value from field to field post-function to the Close transition of the issue's workflow.

  • Select the Single version picker in the Source field.

  • Select the Fix Version/s in the Destination field.

  • Select the Conditional execution and write the following script:

    Code Block
    issue.get("resolution")?.getName() == "Fixed"




Click here to know the post-function features

...

This post-function is used to send an email to certain recipients specified in the post-function configuration

Sample use cases:(lightbulb)

(lightbulb) Send an Email to the voters of the issue when a new feature is approved.

panel
Expand
titleSteps


  • Add the Email issue post-function to the Approve transition of the issue's workflow.

  • Input the subject of the Email in Subject

  • Select the Voters in Issue members under Recipients.

...


(lightbulb) On the creation of an issue send an Email notification to email addresses in a checkboxes custom field type.

panel
Expand
titleSteps


  • Add the Email issue post-function to

the 
  • the Create

 transition
  •  transition of the issue's workflow.

  • Input the subject of the Email in Subject

  • Write the following Groovy template

in 
  • in Email addresses

 field
  •  field.

    Code Block
    ${issue.getAsString("EmailIds")}




Click here to know the post-function features

...

This post-function is used to increase the value of a numerical field by one.

Sample use cases:(lightbulb)

(lightbulb) Track the number of times a bug fix was rejected by the QA team.

panel
Expand
titleSteps


  • Create a Rejection counter numerical custom field.

  • Add the Increase value of field post-function to the Reject transition of the Bug workflow.

  • Select the Rejection counter field.



Click here to know the post-function features

Link issues to the current issue

This post-function is used to link the current issue to all issues that satisfy a parameterized JQL query.

Sample use cases:(lightbulb)

(lightbulb) Link all the Faults in Service desk project to the current issue with "blocks" link type

panel
Expand
titleSteps


  • Add the Link issues to current issue post-function to the transition

  • Input the following JQL expression

    Code Block
    project = "Service Desk project" and issuetype =  Fault  


  • Select 50 in Max. issues

  • Select the blocks link type in Issue link



Click here to know the post-function features

Scripted (Groovy) operation on issue

This post-function is used to execute a Groovy expression against the current issue.

Sample use cases:(lightbulb)

(lightbulb) Copy attachments of the sub-tasks to the parent

panel
Expand
titleSteps


  • Add the Scripted (Groovy) operation on issue post-function to the transition

  • Input the following Groovy expression

    Code Block
    import com.atlassian.jira.issue.AttachmentManager
    AttachmentManager attachmentManager = ComponentAccessor.getAttachmentManager()
    
    def attach = []
    issue.get("subtasks").each{
      if(it.get("attachment"))
      {
        attach += it.get("attachment") 
      }
    }
    attach.each{
      attachmentManager.copyAttachment(it,currentUser,issue.key)
    }
(warning)
  • (warning)Note that testing the script would copy the attachments to the issue


(lightbulb) Copy the attachments of the issue to the newly created issue

panel
Expand
titleSteps


  • Add the Scripted (Groovy) operation on issue post-function to the Create transition

  • Input the following Groovy expression

    Code Block
    import com.atlassian.jira.component.ComponentAccessor
    import com.atlassian.jira.issue.AttachmentManager
    
    AttachmentManager attachmentManager = ComponentAccessor.getAttachmentManager()
    def attach = issue.get("attachment")
    
    attach.each{
      attachmentManager.copyAttachment(it,currentUser,transientVars.newIssue?.key)
    }
(warning)
  • (warning)Note that testing the script would copy the attachments to the issue


Place the post-function to the end of the list of post-functions.

...

This post-function is used to set a field to the value of a user property of the current user or the user in an issue field.

Sample use cases:(lightbulb)

(lightbulb) Store the Country, Department, Location, and Pin information of the Reporter of an issue into the issue itself while creating it.

panel
Expand
titleSteps


  • Create a user entity property to store the Country information.

  • Add the Set field value of user property post-function to the transition

  • Select the field to which the Country information is supposed to be copied.

  • Repeat the above steps for all the other fields.



Click here to know the post-function features

...

This post-function is used to set a selected field of all issues related to the current issue through a selected link type. 

Sample use cases:(lightbulb)

(lightbulb) Display the Man hours (a custom Numeric field) of an Epic as the sum of Man hours of all the user stories linked to the Epic.

panel
Expand
titleSteps


  • Add the post-function Set field value of related issues to the Create transition of the Story workflow.

  • Select the Man hours field.

  • Choose Epic of the current issue under Which Issue(s)

  • Select the Value type as Groovy template

  • Write the following content in the Value section.

    Code Block
    <%=textutils.noNull(issue.get("Man hours")) + textutils.noNull(linkedIssue?.get("Man hours"))%>

...



(lightbulb) Set the issue's due date to the maximum due date set in its sub-tasks.

panel
Expand
titleSteps


  • Add the Set field value of related issues to the Create transition of the subtask's workflow.

  • Select the Due date field.

  • Choose Parent issue of the current issue under Which issue(s)

  • Select the Value type as Groovy Expression

  • Write the following content in the Value section.

    Code Block
    issue.get("duedate")


  • Write the following in Conditional execution section

    Code Block
    linkedIssue?.get("duedate") <= issue.get("duedate")

...



(lightbulb) On the Approval of an issue copy its components to issues linked to it with duplicates link type, only if the linked issue belongs to the same project as the current issue.

panel
Expand
titleSteps


  • Add the Set field value of related issues post-function to the Approval transition of the issue's workflow.

  • Select the Components field.

  • Select Issues linked to the current issue through the following link type under Which issues

  • Choose the issue link type as duplicates

  • Select the Value type as Groovy Expression

  • Write the following content in the Value section.

    Code Block
    issue.getAsString("components")


  • Write the following in Conditional execution section

    Code Block
    issue.get("project").getKey() == relatedIssue?.get("project")?.getKey()



(lightbulb)(lightbulb) On the creation of a sub-task add its summary to the description of its parent

paneltrue
Expand
titleSteps


  • Add the Set field value of related issues post-function to the Create transition.

  • Select the Description field.

  • Select Parent issue of the current issue under Which issue(s)

  • Select Groovy expression in the Value type.

  • Write the following content in the Value section.

    Code Block
    languagegroovy
linenumbers
  • org.codehaus.groovy.runtime.NullObject.metaClass.toString = {return ''}
    relatedIssue?.get("description").toString() + "\n" + issue.get("summary")


  • Place the post-function after the Creates issue originally built-in post-function.



Click here to know the post-function feature

Set field value

This post function is used to set a field value with value(s) specified in the post-function. The value set can either be a fixed text or the result of the evaluation of a Groovy expression or the result of a Groovy template.

...

(lightbulb) Set a custom field with the total work log entered during the rework on an issue

paneltrue
Expand
titleSteps


  • Add the Set field value post-function to the Rework transition of the issue's workflow.

  • Select the Time spent on rework custom field.

  • Select Groovy expression in the Value type.

  • Write the following content in the Value section.

    Code Block
    languagegroovy
linenumbers
  • return issue.getModifiedFields().get("worklog")?.newValue?.worklogResult()?.getWorklog()?.getTimeSpent()

...



(lightbulb) Assign a reopened issue to the last person who last commented it.

paneltrue
Expand
titleSteps


  • Add the Set field value post-function to the Reopen transition of the issue's workflow.

  • Select the Assignee field.

  • Select Groovy expression in the Value type.

  • Write the following content in the Value section.

    Code Block
    languagegroovy
linenumbers
  • if(issue.get("comment"))
    {
      issue.get("comment").last().getAuthorApplicationUser()
    }



Lightbulb on (on)(lightbulb) Automatically add the Reporter of an Epic to the watchers of its User Stories while creating a Story.

paneltrue
Expand
titleSteps


  • Add the Set field value post-function to the Create transition.

  • Select the Watchers field.

  • Select Groovy expression in the Value type.

  • Write the following content in the Value section.

    Code Block
    languagegroovy
linenumbers
  • issue.epic?.get("reporter")


  • Select Add source value(s) to destination field option

  • Place the post-function after the Creates issue originally built-in post-function.

...


(lightbulb) Capture the developer who resolved an issue in a custom single-user picker field

panel
Expand
titleSteps


  • Create a Resolved By single-user picker custom field.

  • Add the Set field

value 
  • value post-function to the "Resolve Issue" transition.

  • Select the Resolved By field.

  • Select Groovy expression in the Value type.

  • Write the following content in the Value section.

    Code Block
    currentUser.name

...



(lightbulb) Assign the issue to the Project lead if the issue is unassigned

panel
Expand
titleSteps


  • Add the Set field

value 
  • value post-function to the Create transition of the issue workflow.

  • Select the Assignee field.

  • Select Groovy expression in the Value type.

  • Write the following content in the Value section.

    Code Block
    issue.get("project").getProjectLead()


  • Write the following content in the Conditional

execution section
  • execution section.

    Code Block
    issue.get("assignee")


  • Place the post-function after the Creates issue originally built-in post-function.

...


(lightbulb) On creating an issue, pick the component of the issue from a cascading field that carries the Main and Sub-components

paneltrue
Expand
titleSteps


  • Add the Set field value post-function to the Create transition of the issue's workflow.

  • Select the Component/s field.

  • Select Groovy expression in the Value type.

  • Write the following content in it.

    Code Block
    languagegroovy
linenumbers
  • import com.atlassian.jira.issue.fields.CustomField;
    CustomField customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Cascade");
    def value = issueObject.getCustomFieldValue(customField);
    return (value?.get(null)?.getValue() + "-" + value?.get("1"))


  • Place the post-function after the Creates issue originally built-in post-function.

...


(lightbulb) Set the Component/s of the issue to components whose lead is the current user

paneltrue
Expand
titleSteps


  • Add the Set field value post-function to the Create transition of the issue workflow.

  • Select the Components field.

  • Select Groovy expression in the Value type.

  • Write the following content in the Value section.

    Code Block
    languagegroovy
linenumbers
  • def components = issue.getAvailableOptions("components")
    def newComponents = components.findAll{
      it?.getLead() == currentUser.getKey()
    }
    return newComponents

...



(lightbulb) On creating a Bug set its Affects Version/s to the most recently released version

paneltrue
Expand
titleSteps


  • Add the Set field value post-function to the Create transition of the Bug's workflow.

  • Select the Affects Version/s field.

  • Select Groovy expression in the Value type.

  • Write the following content in the Value section.

    Code Block
    languagegroovy
linenumbers
  • def versions = issue.getAvailableOptions("versions")
    def versionMap = [:]
    if (versions)
    {
      versions.each(){
        if(it.getReleaseDate())
        {
          versionMap.put(it?.getReleaseDate(),it.getName())
        }
      }
    }
    if(versionMap.min{it.key}?.getValue())
    {
      return versionMap.min{it.key}?.getValue()
    }
    else
    {
      return versions = []
    }


  • Place the post-function after Creates issues originally built-in post-function.

...


(lightbulb) On creating a Bug with Highest priority set its Fix Version/s to the upcoming release

paneltrue
Expand
titleSteps


  • Add the Set field value post-function to the Create transition of the Bug's workflow.

  • Select the Affects Version/s field.

  • Select Groovy expression in the Value type.

  • Write the following content in the Value section.

    Code Block
    languagegroovy
linenumbers
  • def versions = issue.getAvailableOptions("versions")
    def versionMap = [:]
    if (versions)
    {
      versions.each(){
        if(it.getReleaseDate())
        {
          versionMap.put(it?.getReleaseDate(),it.getName())
        }
      }
    }
    if(versionMap.min{it.key}?.getValue())
    {
      return versionMap.min{it.key}?.getValue()
    }
    else
    {
      return versions = []
    }


  • Write the following in Conditional execution section

    Code Block
    issue.get("priority").getName() == "Highest"


  • Place the post-function after Creates issues originally built-in post-function.

...


(lightbulb) Set the Affects Version/s of the issue to Affects Version/s of all its linked issues

panel
Expand
titleSteps


  • Add the Set field

value 
  • value post-function to the transition

  • Select the Affects Version/s field.

  • Select Groovy expression in the Value type.

  • Write the following content in the Value section

    Code Block
    Set versions = []
    issue.get("issuelinks").each(){
      versions += it.getDestinationObject().get("versions")
    }
    return versions

...



(lightbulb) Set the due date to today's date

paneltrue
Expand
titleSteps


  • Add the Set field value post-function to the transition.

  • Select the Due date field.

  • Select Groovy expression in the Value type.

  • Write the following content in the Value section.

    Code Block
    languagegroovy
linenumbers
  • new Date()



Lightbulb on (on)(lightbulb) Identify all comments made between transitions A and B and add them to a custom text field

paneltrue
Expand
titleSteps


  • Create Date-Time picker

fields 
  • fields Date of Transition A

 and 
  •  and Date of Transition B

  • Create a Mulit-line text

field 
  • field Comments between transitions A and B

  • Add

the 
  • the Set field

value 
  • value post-function to the transition A

  • Select

the 
  • the Date of Transition A

 field
  •  field.

  • Select Groovy expression in the Value type.

  • Write the following in

the 
  • the Value

 section
  •  section

    Code Block
    new Date()


  • Add the Set field value post-function to the transition B.

  • Select

the 
  • the Date of Transition B

 field
  •  field.

  • Select Groovy expression in the Value type.

  • Write the following in

the 
  • the Value

 section
  •  section

    Code Block
    languagegroovy
linenumbers
  • new Date()


  • Add

the 
  • the Set field

value 
  • value post-function to the transition on whose trigger you want to identify the comments

  • Select

the 
  • the Comments between transitions A and B

 field
  •  field

  • Write the following in

the 
  • the Value

 section
  •  section

    Code Block
    Comments between Transition A and Transition B are:
    <% issue.get("comment").each() {
      if(it.created > issue.get("Date of Transition A") && it.created < issue.get("Date of Transition B") || it.updated > issue.get("Date of Transition A") && it.updated < issue.get("Date of Transition B"))
      {
       print "Comment added/updated by: "+ it.getAuthorFullName() + " at " + it.getUpdated() + "\n" + it.body + "\n"
      }
    }
    %>



(lightbulb) Set the due date to issue created plus five days

paneltrue
Expand
titleSteps


  • Add the Set field value post-function to the transition.

  • Select the Due date field.

  • Select Groovy expression in the Value type.

  • Write the following content in the Value section.

    Code Block
    languagegroovy
linenumbers
  • issue.get("created") + 5



(lightbulb) Select the Installation tasks in the Checkboxes/Multi-select type field when all the Installations are done

paneltrue
Expand
titleSteps


  • Add the Set field value post-function to the transition.

  • Select the Checkboxes field.

  • Select Groovy expression in the Value type.

  • Write the following content in the Value section.

    Code Block
    languagegroovy
linenumbers
  • issue.getAvailableOptions("<Name of the field>").findAll{
      it.getValue().contains("Installation")
    }



(lightbulb)(lightbulb) On the creation of an issue set a custom text field called Current time to the current time in the current user's timezone

paneltrue
Expand
titleSteps


  • Add the Set field value post-function to the Create transition of the issue's workflow.

  • Select the Current

time field
  • time field.

  • Select Groovy expression in the Value type.

  • Write the following content in the Value section.

    Code Block
    languagegroovy
linenumbers
  • import com.atlassian.jira.timezone.TimeZoneManager
    
    // access timeZone of current user
    
    def userTimeZone = getComponent(TimeZoneManager).getLoggedInUserTimeZone()
    c1 = GregorianCalendar.getInstance(userTimeZone);
    return c1.format("HH:mm")



(lightbulb) Add the members of the selected Organizations to the Watchers of the issue

paneltrue
Expand
titleSteps


  • Add the Set field value post-function to the transition of the issue's workflow.

  • Select the

Watchers field
  • Watchers field.

  • Select Groovy expression in the Value type.

  • Write the following content in the Value section.

    Code Block
    languagegroovy
linenumbers
  • import com.atlassian.servicedesk.api.organization.OrganizationService
    import com.atlassian.servicedesk.api.util.paging.SimplePagedRequest
    
    def orgs = issue.get("Organizations");
    if (!orgs)
        return [];
    def organizationService = getComponent(OrganizationService)
    def pagedRequest = SimplePagedRequest.paged(0,1000)
    Set users = []
    
    for (org in orgs) {
        def query = organizationService.newUsersInOrganizationQuery().customerOrganization(org).pagedRequest(pagedRequest).build()
        result = organizationService.getUsersInOrganization(currentUser, query)
        if (result.isRight())
          users.addAll(result.getRight().getResults())  
    }
    return users;



(lightbulb) Add the issue to the current active Sprint

paneltrue
Expand
titleSteps


  • Add the Set field value post-function to the transition of the issue's workflow.

  • Select the

Sprint field
  • Sprint field.

  • Select Groovy expression in the Value type.

  • Write the following content in the Value section and replace the <Board Id> with the actual board id in the code.

    Code Block
    languagegroovy
linenumbers
  • import com.atlassian.greenhopper.service.rapid.view.RapidViewService
    import com.atlassian.greenhopper.service.sprint.SprintService
    import com.atlassian.greenhopper.service.PageRequests
    import com.atlassian.greenhopper.service.sprint.SprintQuery
    import com.atlassian.greenhopper.service.sprint.Sprint
    import com.atlassian.greenhopper.service.sprint.Sprint.State
     
    def boardId = <Board Id>
    def board = getComponent(RapidViewService).getRapidView(currentUser, boardId).get()
    def SprintService = getComponent(SprintService)
    
    def sprintQuery = SprintQuery.builder().states(Collections.singleton(State.ACTIVE)).build()
    def sprintsOutcome = SprintService.getSprints(currentUser, board, PageRequests.all(), sprintQuery)
     
    if (sprintsOutcome.isInvalid()){
      throw new UnsupportedOperationException(sprintsOutcome.toString())
    }
    def sprints = sprintsOutcome.get().getValues()
     
    if (sprints.size() > 1){
      throw new UnsupportedOperationException("More than one sprint is active")
    }
    return sprints[0].getId()
    




Click here to know the post-function features.

Set issue, user or project entity property value post-function

This post-function is used to set the issue, user or project entity property.

Sample use cases:

(lightbulb) On the creation of a ticket, create a user entity property Profession for the current user.

panel
Expand
titleSteps


  • Add the Set issue, user or project entity property value post-function to the Create transition of the issue workflow.

  • Select Current user from Entity field.

  • Input Profession in Property name field.

  • Select Constant or Groovy Template in Value type field.

  • Input "Doctor" in the Value field.

  • Place the post-function after the Creates issue originally built-in post-function.



Click here to know the post-function features.

...

This post-function is used to set the Security Level of the current issue based on the project role to which the current user belongs.

Sample use cases:

...

(lightbulb) Set a different issue security level depending on whether the issue is being created by an internal user or by an external user (e.g. a customer).

panel
Expand
titleSteps


  • Add the Set issue security from user property

function 
  • function post-function to the Create transition of the issue workflow.

  • Select the Security Level field.

  • Select Administrators in the Project Role.

  • Select Admin Prod in

the Issue
  • the Issue Security Level

  • Place the post-function after the Creates issue originally built-in post-function.



Click here to know the post-function features

...

This post-function is used to trigger a transition on the current issue

Sample use cases:

...

(lightbulb) Start the progress on an issue immediately after its creation if its priority is Highest. 

panel
Expand
titleSteps


  • Add the Transition issue post-function to the Create transition of the issue workflow.

  • Input the transition name or ID of Start Progress transition

  • Place the post-function after the Creates issue originally built-in post-function.

  • Write the following script in Conditional execution

    Code Block
    issue.get("priority").getName() == "Highest"



(lightbulb) Transition an issue only when all the Business Approvers approve the request through a comment "Approved"

panel
Expand
titleSteps


  • Add the Transition issue post-function to the transition of the issue workflow.

  • Input the transition name or ID of the transition you wish to trigger

  • Write the following script in Conditional execution

    Code Block
    def HashSet users = []
    def regExp = ~/^(?i)approved.*/
    issue.get("comment").each{
      if(it.getBody().matches(regExp) &&
        it.getAuthorApplicationUser() in issue.get("MUP") &&
        !(it.getAuthorApplicationUser() in users))
      {
        users += it.getAuthorApplicationUser()
      }
    }
    users.size()==issue.get("MUP")?.size()




Click here to know the post-function features

Transition related issues

This post-function triggers a transition on all issues related to the current issue

Sample use cases:

...

(lightbulb) Resolve the associated support request(s) when a bug is resolved, and copy all comments from the bug to the support request(s)

panel
Expand
titleSteps


  • Add the Transition related issues post-function to the transition Resolve of the Bug workflow.

  • Input the transition name or ID of the Resolve transition of the support workflow.

  • Select Issues linked to the current issue through any link type from Which Issues

  • Set the Comment field to copy the comments from the current issue.

  • Place this post-function at the end in the list of post-functions.



Click here to know the post-function features

...

This post-function is used to trigger a transition on the parent issue of the current issue

Sample use cases:

(lightbulb)(lightbulb) Start progress on the parent issue when someone started working on its sub-task.

panel
Expand
titleSteps


  • Add the Transition parent issue post-function to the Start Progress transition of the workflow.

  • Input the Start progress transition name/ID.

  • Place this post-function at the end in the list of post-functions.



Click here to know the post-function features

...

This post-function is used to unlink issues from the current issue based on the result of a Groovy condition.

Sample use cases:

(lightbulb)(lightbulb) On rejection of an issue, unlink all its linked issues

panel
Expand
titleSteps


  • Add the Unlink issues from the current issue post-functionto the Reject transition of the workflow.

  • Write true in Condition


Click here to know the post-function features