/
Shared Actions

Shared Actions

Shared Actions are a series of one or more post functions, run in sequence, that can be reused across numerous workflow transitions. A Shared Action can then be updated in one place - the Shared Actions Editor page - and it will update everywhere that it is used. Adding a Shared Action to a transition only requires using the Shared Action post-function.

To access Shared Actions:

  1. Log in to your Jira instance as an administrator.

  2. Click the Settings icon in the upper right corner and select Apps.

  3. Under Jira MISC WORKFLOW EXTENSIONS in the left-hand panel, click Shared actions.

The Shared Actions page (Figure 1, right) lists all Shared Actions that have been created and includes the following:

  • Search - Filter the list of Shared actions by action name.

  • Create new action - Click to create a new Shared Action.

  • Shared action list - A list of all Shared Actions for the instance. The list includes the following information:

    • Action name - The action name and description (if any). Click the name to edit the Shared action.

    • Used in - A badge indicating the number of places the Shared Action is used in your instance.
      Hover over the badge to see a detailed list of where the Shared Action is used.

    • By - The user who created the action, or the last user to edit or enable/disable the action.

    • Last modified - When the action was last modified (edited or enabled/disabled).

    • Post-functions - The number of post-functions included in the Shared Action.
      Hover over the badge to see a list of the post-functions included in the Shared Action.

    • Action menu - Click to open a menu with specific actions for the Shared Action:

      • Duplicate - Create a copy of the Shared Action. The new Shared Action will have the same name as the original, with “- copy” appended.

      • View Summary - Open the Summary window (Figure 2, right), listing the Post-functions included in the Shared Action and where the Shared Action is currently being used.

      • ID - The Jira ID of the Shared Action. Click the menu option to copy the ID value to your clipboard. This value can be used in the JMWE Logs page to filter the logs by Action ID.

      • Delete - Permanently delete the Shared Action.
        You cannot delete a Shared action when it is used in any workflow transitions. You need to remove it from all workflows before trying to delete it.

Note: You can click the Used in and Post-functions badges to open the Shared Action Editor!

Filter and Sort

You are viewing the documentation for Jira Cloud.

 

admin-SharedActions.png
Figure 1 - Shared actions page
Modal window displaying summary of a Shared Action
Figure 2 - Shared Action Summary

 

 

Configure a Shared Action

When you create or edit a Shared Action, the Shared Action Editor will open (Figure 3, right). The Shared Action Editor uses the JMWE Automation Rule Builder, consisting of two side-by-side panels; the left panel has buttons for selecting each configuration category (e.g. What for the post-functions to be included in the Shared Action), and the right panel includes specific configuration options for the selected category.

To configure a Shared Action set the following configurations:

  1. Action name (Point 1, Figure 3, right) - Required. Click the name to edit. Enter a meaningful name and hit Enter, or click the check button, to save.

  2. Description (Point 1, Figure 3, right) - Click Add a description to edit the Shared Action description. Enter a detailed explanation of the action and click the check button to save.

  3. What/Post-functions (Point 2, Figure 3, right) - Click the What header or the Post-functions button. In the right panel, select a post-function from the list to add the first post-function, or click Add post-function (Point 2, Figure 3, right) to add additional post-functions. See Post-functions, below for more information.

  4. Where/Used in (Point 4, Figure 3, right) - Read-only. Click the Where header or the Used in button to view the list of places your Shared Action is being used. You can search the list of locations using the search box, and filter using the Type pulldown menu. See Shared Actions for details on how to add a Shared Action to a workflow transition or other action.

  5. Click Save to save the Shared Action.

You can use the View Summary button at the bottom of the Rule Builder to view a complete list of post-functions used in your Shared Action!

Post-functions

When you first create a new Shared Action, it will not include any post functions; select the first post function from the list in the right panel to add it. You can add subsequent post functions to the sequence by clicking Add Post-function in the upper-right corner of the panel, and then select the post function you need in the window that opens.

The configured post functions will run in the order in which they are listed.

Add a post function

  1. In the right panel, click Add post function at the top of the panel.

  2. Select a post-function from the list and click Add. You can search for the post-function by name, and filter by type using the fields at the top of the window.

  3. The post-function configuration window will open. Configure the selected post-function as needed, then click Save. See Post-functions for more details on all of the available post-functions.

Modify or delete a post function

The steps to modify or delete a post function depend on the post function view you are using. See Post function views directly below for more information.

Post function views

Post-function errors

When a Shared Action post-function encounters an error, an error icon will be displayed on the post-function tile (Figure 6, right). Hover over the icon to see additional details on the error. Click the error icon to open the JMWE Logs Administration page; the logs will be filtered automatically for the post-function that encountered the error.

Passing variables within a sequence

It is possible to pass data from one post-function to all subsequent post-functions within a Shared Action by using the {% setContextVar %} Nunjucks tag. When using a Build-your-own (scripted) post-function, the variable can be set anywhere within your script; when using other post-functions, the most common place to set a variable is in the Conditional Execution configuration.

  • context: Holds all the context variables added in the current post-function. For example, if you create a context variable myVar in the first post-function of the sequence:

    {% setContextVar myVar = "a value" %}

    This variable will then be available to subsequent post-functions as:

    {{ context.myVar }}

Variables specific to the Create Issue post-function

  • newIssueKey: Stores the issue key of the last issue created by a Create Issue(s) post-function in the action. You can access it as:

    {{ context.newIssueKey }}

     

  • newIssueKeys: Stores an array of the keys of all the issues created by any Create Issue(s) post-function in the action. You can access the created issues from:

    For example: to add a comment on the current issue with the keys of the issues created previously:

You can access the information of a specific issue using the issue filter. For example: To get the assignee of the issue created by the Create issue(s) post-function: