Spaces:
Sleeping
Sleeping
File size: 9,424 Bytes
4b618f4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | # Shared Extensions
> المصدر: https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461930510/Shared+Extensions
---
Open

Figure 1 - Shared Extensions
**Shared extensions** allow you to create extensions (Post functions, Conditions, and Validators) that run a sequence of extensions in order; the shared extensions can then be added to multiple workflow transitions. Shared extensions enable you to create an extension once and then use them almost anywhere. This helps maintain the most common configurations, making changes far simpler by enabling updates in one location that then apply to all transitions that utilize the Shared extension.
It is also possible to add conditions and validators from other Jira apps to a JMWE Shared extension, including Jira native conditions and validators. Numerous other third-party conditions and validators can also be added, greatly expanding the capabilities of Shared extensions!
The **Shared extensions** page (Figure 1, right) includes tabs for each of the extension types - *Post functions*, *Conditions*, and *Validators*. Each tab lists all the existing extensions and displays a link to view where each shared action is currently used.
A shared extension can be used in:
- [Scheduled actions](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461930716 "https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461930716")
- [Event-based actions](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461996144 "https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461996144")
- Other shared extensions
To open the **Shared extensions** page:
1. Log in to your JIRA Server instance as an administrator.
2. Click on the **Administration** icon in the upper right corner.
3. Select **Manage Apps**.
4. Locate *JIRA MISC WORKFLOW EXTENSIONS* in the left panel and select **Shared extensions**.
**Note**: Within JMWE for Jira Data Center, there is a distinction between a Shared *extension* and a Shared *action*. A Shared Extension is a shared among multiple transitions and is managed through the **JMWE Administration** page. A Shared action is a type of Shared Extension that contains post functions, and is added to transitions using the [Shared action post function](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461996736 "https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461996736").
## Add a Shared Extension
To add a shared extension:
1. From the *Shared extensions* page, select the tab for the extension you want to add (e.g. Action for a Shared Action).
2. Click the **Add** button to the right of the tabs (e.g. **Add shared condition** for Conditions).
3. An editor window will open (for example, the *Shared action editor*, Figure 2, right). The editor for each of the extension types is nearly identical. The fields available are:
- **Name**: Enter a name for the extension.
- **Description**: Enter a more detailed explanation of what the extension would accomplish.
- **Post-functions** or **Conditions** or **Validators**: The last section of the editor enables you to add a sequence of extensions to the shared extension. For more information on using the editor, see **Extensions editor**, below.
4. Click **Save**.
**Note**: It is not possible to add a Shared Extension to itself as it causes an infinite loop. The Shared Extension calls itself, which calls itself again, and so on indefinitely. To avoid creating an infinite loop, you will either be unable to add Shared Extensions to themselves when editing them, or you will get an ‘Infinite loop detected’ error message when trying to save a Shared Extension.
Open

Figure 2 - Shared Action Editor
## Extensions editor
The extension editor is where you create the sequence of extensions that will be executed when the shared extension is triggered. To add a post function, condition, or validator (depending on the type of Shared extension):
1. Click the add button (e.g. the **Add post function** button).
2. A pop-up window will open listing all of the available extensions. Select an extension and click **Add**.
3. You will be taken to the configuration screen for the extension. Configure the extension as needed and click **Add**.
4. The *Shared extension* page will open, with the newly-added extension listed (pictured, right, under **Post functions**).
Within the editor, existing extensions can be reordered, enabled or disabled, modified, or removed.
- Click-and-drag on the move icon and release to reorder the extension.
- Click **Edit** to open the extension configuration page.
- Click the **Enable/Disable** toggle to enable or disable the extension.
- Click **Remove** to remove the extension.
In addition to the tools above, the Extension editor includes execution log information, including the last time the extension executed, and status information for the last several executions.
Click the caret next to **CURRENT CONFIGURATION** to switch between displaying a count of each status (e.g. warnings or errors) and icons representing successes, errors, and warnings.
If displaying icons, you can click on each icon to open a pop-up window (Figure 4, right) with more details on that specific log file, including the context, the issue on which the extension operated, the user, and a shortcut to fetch the full Jira logs. You can click the **Acknowledge** button in this window to acknowledge that log and clear it from the list.
## Edit a Shared Extension
To edit an existing shared extension:
1. From the extension’s tab, click the menu button next the shared extension you wish to modify and select **Edit**. The editor (pictured above, right) will open.
2. Modify the extension details in the editor screen**.**
3. Click **Save** to save the changes.
When you try to add a [Shared Action](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461996736 "https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461996736") post function, Shared Condition, or Shared Validatorwhile editing a shared extension, you’ll notice that the shared extension you are currently editing is disabled for selection. This is to avoid creating an infinite loop by adding the Shared Extension to itself.
## Copy a Shared Extension
Sometimes it is easier to create a new shared extension based on one that already exists. To copy a shared extension:
1. On the *Shared extensions* page, click the menu icon to the right of the shared action you wish to duplicate. Select **Copy**.
2. A new shared extension is created with “Copy of” in front of the original action name. Rename the extension as needed.
3. Follow the steps in **Edit a shared extension** above, to make modifications.
## Delete a Shared Extension
To delete a shared extension:
1. On the **Shared extensions** page, click the menu icon next to the shared extension you wish to delete and select **Delete** to remove the shared extension permanently.
2. Click **OK** in the confirmation dialog to confirm.
**Please note**: the **Delete** option is disabled when the shared extension is used in:
- [Scheduled actions](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461930716 "https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461930716")
- [Event-based actions](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461996144 "https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461996144")
- Workflow transitions
- Other shared extensions
The shared extension needs to be removed from all of the above before it can be deleted.
Open

Figure 3 - Shared Action Example
Open

Figure 4 - Shared Extension Log Details
## Use a Shared Extension in a workflow
The example below covers adding a **Shared action** to a workflow; the process for adding a **Shared condition** or **Shared validator** is nearly identical.
You can use a shared action in a Jira workflow by using the [Shared Action](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461996736 "https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461996736")post-function. When added to a transition, this post-function lists all the shared actions configured in the **Shared extensions** page, allowing a workflow administrator to select one action and run it during the specified transition.
For example, say you have configured several actions in the **Shared actions** page (Figure 1, above right).
To add one of these shared actions to a transition (using the *Shared action* post-function):
1. Click **Edit** for the workflow that has the transition.
2. In the *Workflow Designer*, select the transition.
3. Click **Post functions** in the properties panel.
4. Click **Add post function**.
5. Select **Shared Action** from the list of post-functions. The **Shared Action Post-function** configuration screen will open.
6. Select the appropriate shared action and configure other details as required.
7. Click **Add** to add the post-function to the transition.
8. Publish the workflow.
Open

Figure 5 - Shared Action post-function |