...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
This section has use cases which help you in understand the usage of Post-functions provided by JMWE.
On this page:
Table of Contents | ||
---|---|---|
|
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:
On the creation of a Bug assign it to a user only if he is a Product Owner
Expand | ||||
---|---|---|---|---|
| panel||||
|
...
Assign an issue to a member of the QA team when the issue is transitioned to Ready for testing status
Expand | ||||
---|---|---|---|---|
| panel||||
|
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:
When a tester reopens an issue assign the issue to a Developer who last worked on it.
Expand | ||||
---|---|---|---|---|
| panel||||
|
...
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.
Expand | ||||
---|---|---|---|---|
| panel||||
|
Click here to know the post-function features
Clear field value
Clear the Fix Version/s field on the reopening of a ticket.
Expand | ||||
---|---|---|---|---|
| panel||||
|
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.)
Clear a set of fields on all the linked issues of the current issue when an Abort is triggered on the current issue
Expand | ||||
---|---|---|---|---|
| panel||||
|
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:
A customer using Jira Service Desk should be notified via a comment when someone has started working on their support request.
Expand | ||||||||
---|---|---|---|---|---|---|---|---|
| panel||||||||
| true |
We have started working on your support request - $issue.key. We will get back to you within 24 hours. |
...
On resolving or closing the issue, comment the issue with a summary of the worklog.
Expand | ||||
---|---|---|---|---|
| panel||||
| ||||
linenumbers | true |
<% 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 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 | ||||||||
---|---|---|---|---|---|---|---|---|
| panel||||||||
| true |
The impediment $issue.key- $issue.summary has been resolved. |
...
Add a comment on all the sub-tasks when the parent is cancelled
Expand | ||||||||
---|---|---|---|---|---|---|---|---|
| panel||||||||
| linenumbers | true
The parent of the issue i.e $issue.key has been canceled. |
...
On the Approval of an issue, copy the comment added if any to its sub-tasks.
Expand | ||||||||
---|---|---|---|---|---|---|---|---|
| panel||||||||
| linenumbers | true
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.
...
The Service Desk Agent responsible for a support request should be notified when the linked Bug is resolved.
Expand | ||||
---|---|---|---|---|
| panel||||
|
Click here to know the post-function features
...
This post-function can be used to create a new issue.
Sample use cases:
On the approval of a Story, create two sub-tasks: one for Development and another for QA.
Expand | ||||
---|---|---|---|---|
| panel||||
Two sub-tasks will be created, one for "Development" and another for "Subtask" |
...
Create a bug in Project B when the developer confirms a Bug in Project A for the component UI
Expand | ||||
---|---|---|---|---|
| panel||||
|
...
To onboard a new employee in the HR database, create tasks one for each value selected in "Onboarding Tasks" multi-valued field
Expand | ||||
---|---|---|---|---|
| panel||||
|
...
An Epic has a Story and the Story has a sub-task. When the sub-task is reopened we want to create a bug in another project linking it to the sub-task. On creation of the Bug, set its Epic link to the Story's Epic link
Expand | ||||
---|---|---|---|---|
| panel||||
|
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:
Copy the Fix Version/s field from the Epic to a Story, while creating a Story.
Expand | ||||
---|---|---|---|---|
| panel||||
|
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:
Copy the Fix Version/s field from the Stories to Epic, after resolving a user story.
Expand | ||||
---|---|---|---|---|
| panel||||
|
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:
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.
Expand | ||||
---|---|---|---|---|
| panel||||
|
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:
Copy the labels from each sub-task to its parent when the sub-task is closed.
Expand | ||||
---|---|---|---|---|
| panel||||
|
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:
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.
Expand | ||||
---|---|---|---|---|
| panel||||
Note: The Component name should be in |
...
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.
Expand | ||||
---|---|---|---|---|
| panel||||
|
...
I want 'Capture for JIRA Environment' field to be copied to the 'Environment' field when a bug is created using Capture for JIRA.
Expand | ||
---|---|---|
| ||
Panel |
|
...
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".
Expand | |||
---|---|---|---|
| |||
Panel |
|
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:
Send an Email to the voters of the issue when a new feature is approved.
Expand | ||||
---|---|---|---|---|
| panel||||
|
...
On the creation of an issue send an Email notification to email addresses in a checkboxes custom field type.
Expand | |||
---|---|---|---|
| |||
Panel |
|
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:
Track the number of times a bug fix was rejected by the QA team.
Expand | ||||
---|---|---|---|---|
| panel||||
|
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:
Link all the Faults in Service desk project to the current issue with "blocks" link type
Expand | ||||
---|---|---|---|---|
| panel||||
|
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:
Copy attachments of the sub-tasks to the parent
Expand | ||||
---|---|---|---|---|
| panel||||
|
Copy the attachments of the issue to the newly created issue
Expand | ||||
---|---|---|---|---|
| panel||||
|
Click here to know the post-function features
...
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:
Store the Country, Department, Location, and Pin information of the Reporter of an issue into the issue itself while creating it.
Expand | ||
---|---|---|
| ||
Panel |
|
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:
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.
Expand | ||||
---|---|---|---|---|
| panel||||
|
...
Set the issue's due date to the maximum due date set in its sub-tasks.
Expand | ||||
---|---|---|---|---|
| panel||||
|
...
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 | ||||
---|---|---|---|---|
| panel||||
|
On the creation of a sub-task add its summary to the description of its parent
Expand | ||||||||
---|---|---|---|---|---|---|---|---|
| panel||||||||
| linenumbers | true
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.
...
Set a custom field with the total work log entered during the rework on an issue
Expand | ||||||||
---|---|---|---|---|---|---|---|---|
| panel||||||||
| linenumbers | true
return issue.getModifiedFields().get("worklog")?.newValue?.worklogResult()?.getWorklog()?.getTimeSpent() |
...
Assign a reopened issue to the last person who last commented it.
Expand | ||||||||
---|---|---|---|---|---|---|---|---|
| panel||||||||
| linenumbers | true
if(issue.get("comment"))
{
issue.get("comment").last().getAuthorApplicationUser()
} |
Automatically add the Reporter of an Epic to the watchers of its User Stories while creating a Story.
Expand | ||||||||
---|---|---|---|---|---|---|---|---|
| panel||||||||
| linenumbers | true
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.
...
Capture the developer who resolved an issue in a custom single-user picker field
Expand | ||||
---|---|---|---|---|
| panel||||
|
...
Assign the issue to the Project lead if the issue is unassigned
Expand | |||||
---|---|---|---|---|---|
| |||||
Panel |
|
...
On creating an issue, pick the component of the issue from a cascading field that carries the Main and Sub-components
Expand | |||||||||
---|---|---|---|---|---|---|---|---|---|
| |||||||||
Panel |
| linenumbers | true
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.
...
Set the Component/s of the issue to components whose lead is the current user
Expand | ||||
---|---|---|---|---|
| panel||||
| ||||
linenumbers | true |
def components = issue.getAvailableOptions("components")
def newComponents = components.findAll{
it?.getLead() == currentUser.getKey()
}
return newComponents |
...
On creating a Bug set its Affects Version/s to the most recently released version
Expand | ||||||||
---|---|---|---|---|---|---|---|---|
| panel||||||||
| linenumbers | true
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.
...
On creating a Bug with Highest priority set its Fix Version/s to the upcoming release
Expand | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| panel||||||||||
| linenumbers | true
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.
...
Set the Affects Version/s of the issue to Affects Version/s of all its linked issues
Expand | ||||
---|---|---|---|---|
| panel||||
|
...
Set the due date to today's date
Expand | ||||||||
---|---|---|---|---|---|---|---|---|
| panel||||||||
| linenumbers | true
new Date() |
Identify all comments made between transitions A and B and add them to a custom text field
Expand | ||||||
---|---|---|---|---|---|---|
| panel||||||
| ||||||
linenumbers | true |
new Date() |
Add
the Set field
value post-function to the transition on whose trigger you want to identify the comments
Select
the
Comments between transitions A and B
field
Write the following in
the
Value
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" } } %>
Set the due date to issue created plus five days
Expand | ||||||||
---|---|---|---|---|---|---|---|---|
| panel||||||||
| linenumbers | true
issue.get("created") + 5 |
Select the Installation tasks in the Checkboxes/Multi-select type field when all the Installations are done
Expand | ||||||||
---|---|---|---|---|---|---|---|---|
| panel||||||||
| linenumbers | true
issue.getAvailableOptions("<Name of the field>").findAll{
it.getValue().contains("Installation")
} |
the current time in the current user's timezone
On the creation of an issue set a custom text field called Current time toExpand | ||||
---|---|---|---|---|
| panel||||
| ||||
linenumbers | true |
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") |
Add the members of the selected Organizations to the Watchers of the issue
Expand | ||||||||
---|---|---|---|---|---|---|---|---|
| panel||||||||
| linenumbers | true
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; |
Add the issue to the current active Sprint
Expand | |||||||||
---|---|---|---|---|---|---|---|---|---|
| panel|||||||||
| linenumbers | true
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 | ||
---|---|---|
| ||
|
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.
Expand | ||||
---|---|---|---|---|
| panel||||
|
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:
...
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).
Expand | ||||
---|---|---|---|---|
| panel||||
|
Click here to know the post-function features
...
This post-function is used to trigger a transition on the current issue
Sample use cases:
...
Start the progress on an issue immediately after its creation if its priority is Highest.
Expand | ||||
---|---|---|---|---|
| panel||||
|
Transition an issue only when all the Business Approvers approve the request through a comment "Approved"
Expand | ||||
---|---|---|---|---|
| panel||||
|
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:
...
Resolve the associated support request(s) when a bug is resolved, and copy all comments from the bug to the support request(s)
Expand | ||||
---|---|---|---|---|
| panel||||
|
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:
Start progress on the parent issue when someone started working on its sub-task.
Expand | ||||
---|---|---|---|---|
| panel||||
|
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:
On rejection of an issue, unlink all its linked issues
Expand | ||||
---|---|---|---|---|
| panel||||
|
Click here to know the post-function features