This section has use cases which help you in understand the usage of Post-functions provided by JMWE.
...
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.)
...
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 text of the 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:
An issue is blocking another and you want to ensure the Assignee of the blocked issue is notified when the impediment has been resolved.
...
Expand |
---|
|
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"))%> |
|
|
Set the issue's due date to the maximum due date set in its sub-tasks.
Expand |
---|
|
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 Expressio n 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") |
|
|
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.
Expand |
---|
|
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 Expressio n 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() |
|
|
...
On the creation of an issue set a custom text field called Current time to the current time in the current user's timezone
Expand |
---|
|
Add the Set field value post-function to the Create transition of the issue's workflow. Select the Current time field. Select Groovy expression in the Value type . Write the following content in the Value section. Code Block |
---|
| 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") |
|
|
...
Expand |
---|
|
Add the Set field value post-function to the transition of the issue's workflow. Select the 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 |
---|
| 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()
|
|
|
Set the Assignee of the issue based on the selected office
Expand |
---|
|
Add the Set field value post-function to the “Create” transition Select the Assignee field. Select the “Value type” as “Groovy expression” Write the following in the Value section Code Block |
---|
switch (issue.getAsString("Office")){
case "New York" : return "tim";
case "Hong Kong" : return "alex"
default : return "john"
} |
|
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:
On the creation of a ticket, create a user entity property Profession for the current user.
...
Transition related issues
This post-function triggers a transition on all issues related to the current issue
Sample use cases:
Resolve the associated support request(s) when a bug is resolved, and copy all comments from the bug to the support request(s)
Expand |
---|
|
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.
|
|
...