Post functions carry out any additional processing required after a Jira workflow transition is executed, such as:
Your add-on needs to declare the URL that Jira will invoke with an HTTP POST after the transition is completed. Each POST will include the issue and transition details and the configuration of the workflow function. It will also include the authentication headers that allow the add-on to validate the authenticity of that request.
Often, the workflow post function will allow some degree of configuration of its behavior. As an example: You may want to react to a state transition only if the issue has a particular label, and you want the project administrator to configure that label. For this purpose, three additional URLs in the descriptor allow you to declare the pages that will show:
All URLs are relative to the base URL that is declared in the connect-container element of the descriptor.
The create and edit urls will need to present a form with relevant configuration for the post function. In order to persist this information with Jira, the page needs to include a snippet of Javascript to facilitate saving this data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
AP.require(["jira"], function(jira) {
// When the configuration is saved, this method is called. Return the values for your input elements.
jira.WorkflowConfiguration.onSave(function() {
var config = {
"key": "val"
};
return JSON.stringify(config);
});
// Validate any appropriate input and return true/false
jira.WorkflowConfiguration.onSaveValidation(function() {
return true;
});
});
For more information, see the javascript API.
Example
For a full add-on example, see the workflow post function example add-on.
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
{
"modules": {
"jiraWorkflowPostFunctions": [
{
"description": {
"value": "My Description"
},
"view": {
"url": "/view"
},
"edit": {
"url": "/edit"
},
"create": {
"url": "/create"
},
"triggered": {
"url": "/triggered"
},
"name": {
"value": "My Function"
},
"key": "workflow-example"
}
]
}
}
key
Type | |
Max length | 100 |
Required | Yes |
Pattern | ^[a-zA-Z0-9-]+$ |
Description | A key to identify this module. This key must be unique relative to the add on, with the exception of Confluence macros: Their keys need to be globally unique. Keys must only contain alphanumeric characters and dashes. The key is used to generate the url to your add-on's module. The url is generated as a combination of your add-on key and module key. For example, an add-on which looks like: 1 2 3 4 5 6 7 8 9
Will have a configuration page module with a URL of |
name
Type | |
Required | Yes |
Description | A human readable name. Represents a string that can be resolved via a localization properties file. You can use the same Example1 2 3 4
|
value |
| ||||||||
i18n |
|
triggered
Type | |
Required | Yes |
Description | The relative URL to the add-on resource that receives the HTTP POST after a workflow transition. It includes the authentication headers that enable the add-on to validate the authenticity of the request. Your app must return a success status code in response to the HTTP POST request. If your app doesn't send a success status code the request will retry, as described in the webhook retry policy. Contents of the HTTP POSTTo understand the type of content that is sent to the add-on after a state transition, you can use the Connect inspector tool. The Connect inspector is a service that lets you generate a temporary Atlassian Connect add-on that you can install in your Cloud development environment to inspect the content of event messages. Here is an example POST body. For brevity, some fields have been removed or truncated. 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
|
url |
|
create
Type | |
Description | The relative URL to the add-on page that allows to configure the workflow post function on creation. |
url |
|
description
Type | |
Description | The description of the workflow post function. This will be presented to the user when they add a new post function to a Jira workflow. Represents a string that can be resolved via a localization properties file. You can use the same Example1 2 3 4
|
value |
| ||||||||
i18n |
|
edit
Type | |
Description | The relative URL to the add-on page that allows to configure the workflow post function once it exists. The edit URL can contain the following context parameters:
|
url |
|
view
Type | |
Description | The relative URL to the add-on page that shows the read-only configuration or summary of the workflow post function. The view URL can contain the following context parameters:
|
url |
|
Rate this page: