Our new Appfire Documentation Space is now live!
Take a look here! If you have any questions please email support@appfire.com
Shared Action
Are you using JMWE for Cloud and want to learn how to use this post-function? Head to our documentation here.
A post-function that runs an action (a sequence of one or more post-functions), created on the Shared actions page, on the current issue or issues related to the current issue.
This post-function together with Shared actions enables you to reuse the most frequently used configurations quickly without having to configure the same scenario multiple times. Any change made to a shared action is instantly applied to all the workflow transitions where it is used.
To add the 'Shared action' post-function to a transition:
Click Edit for the workflow that has the transition you wish to configure the post-function on.
In the Workflow Designer, select the transition.
Click
Post Functions
in the properties panel.Click
Add
post function
.Select
Shared Action
from the list of post-functions. You are navigated to the Shared Action Post-function screen.Add the configuration details as specified in the Configuration details section.
Click
Add
to add the post-function to the transition.Publish the workflow.
Configuration details
Add the following details to configure the post-function to fit your scenario:
Shared action: Select one of the shared actions to be run. The list of shared actions displayed here is defined in Shared actions.
Target issues
Which issues: Select the issue(s) on which the selected shared action is run. By default, the shared action is run on the current issue.
Select one of the following:Current Issue
Sub-tasks of the current issue
Parent issue of the current sub-task
Issues that belong to the current Epic
Epic of the current issue
Child issues of the current issue in the Portfolio hierarchy
Parent issue of the current issue in the Portfolio hierarchy
Issues linked to the current issue through any link type
Issues linked to the current issue through the following link type: Select this option to run the shared action on the issues linked to the current issue with the link type specified in:
Issue Link (Displayed only when Issues linked to the current issue through the following link type is selected): Select an issue link type from the options available.Issues returned by the following Groovy script: Select this option to run the shared action on the issues returned by the Groovy script specified in:
Groovy script (Displayed only when Issues returned by the following Groovy script is selected): Enter a Groovy script that returns either a single Issue object, or a Collection of Issue objects, or a String representing the key of an issue, or a Collection of Strings each representing an issue key. For example:"TEST-1"
["TEST-1","TEST-2"]
ComponentAccessor.issueManager.getIssueObject("TEST-1")
[ComponentAccessor.issueManager.getIssueObject("TEST-1"),ComponentAccessor.issueManager.getIssueObject("TEST-2")]
issue.parentObject
issue.getLinkedIssues()
For more information, refer to Groovy editor in JMWE and Groovy script tester in JMWE.
Issues returned by the following JQL search: Select this option to run the shared action on the issues returned by the JQL expression specified in:
JQL expression (Displayed only when Issues returned by the following JQL search is selected): Enter a JQL search expression, including an optional Groovy Template markup. For example:project = TEST
returns issues of the project with the key TESTproject = ${issue.get("project").key} and assignee = ${currentUser.name}
returns issues of the project the current issue belongs to and assigned to the current user.To operate on issues of a project with key
TEST
and issue type name same as the value in a text field<% if (issue.get("Single line text")) { %> project = TEST and issuetype = ${issue.get("Single line text")} <% } else { %> issuekey=INVALID-1 <% } %>
The
<% if %>
block is necessary to avoid an invalid JQL query when the Single-line text field is empty. In that case, the template returns a valid JQL query that returns no issue (issuekey=INVALID-1). This is in general applicable to JQL operating on select type fields with pre-determined values like Affects Version/s, Checkboxes, etc.The maximum number of issues returned by a valid JQL is limited to 1000.
Conditional execution
Only if the condition is true: Select this option to run the post-function only when the mentioned condition in the following field is met:
Condition (displayed only when Only if the condition is true is selected): Enter a Groovy script, which when returns true, the post-function is run. For more information, refer to Conditional execution using Groovy script.
Error Handling
Make transition fail when an error occurs in this post-function: Select this option to make the transition fail when an error occurs while running the post-function. An error message is displayed to the user notifying the transition failure.
Use case
Consider a scenario where you want to create a testing task every time a development task with Priority
set to Major
is transitioned to closed, and assign the issue to a testing team member.
Perform the following:
Step 1. Create a new Shared Action
Navigate to Jira Settings → Manage apps → Shared actions.
Click
Add shared action
on the top right side.Add the following:
Action name: Enter a meaningful name for the action.
Description: Enter a more detailed explanation of what the action would accomplish.
Post-functions: To add post-functions:
Click
Add
post function
.Select Create / Clone issue(s) from the list of post-functions in the Add post-function window.
Configure this post-function for the required Project and Issue type.
Since you want to create a testing task for a development task withPriority
set toMajor
, select the Only if the condition is true option and addreturn (issue.get("priority").getName() == "Major")
to the Condition field.Click
Add
to add the post-function to the action.Repeat step i through iv using the Assign to role member post-function in step ii, and assigning a Project Role to the intended project role member (Testing role member in this scenario) in step iii.
Both of these post-functions are run in a sequence.
Click
Save
and the newly created action is added to the Shared actions screen.
Step 2. Add the Shared Action post-function to a workflow transition
Click Edit for the workflow that has the transition you wish to configure the post-function on.
In the Workflow Designer, select the transition.
Click
Post Functions
in the properties panel.Click
Add
post function
.Select
Shared Action
from the list of post-functions. You are navigated to the Shared Action Post-function screen.Select the newly created shared action from Step 1.
Click
Add
to add the post-function to the transition.Publish the workflow.