...
This guide explains how to configure the Create Asset workflow post function to automatically create new assets in Jira when specific workflow transitions occur and, optionally, attach to the current issue.
On this page:
|
---|
Add the post function
Add "[AIP] - Create Asset workflow postfunction" to the workflows to create an asset object on transition. If the conditions pass, post function will create an asset and optionally attaches to the current issue.
...
Put the post function in the middle; after issue creates and before "Update change history for an issue and store the issue in the database."
...
Navigate to the desired workflow in Jira.
Locate the workflow editor and identify the transitions where you want assets created.
Drag and drop the [AIP] - Create Asset workflow post function after the Create Issue step and before the Update change history step.
Configure the post function
The post function has several settings to define how assets are created:
Workflow parameters
Parameter | Description |
---|---|
Condition 1 | Groovy script for the post function condition. Function The function must return true, or condition must be empty to pass. If condition fails post function will be ignored. |
Condition 2 | Asset custom field value must be empty before the transition. |
Link to issue | Set newly created asset to asset custom field. |
Target Asset custom field | Specify the custom field to link the asset. |
Asset Type | Type of asset to create. |
Attributes (optional) | Target attribute to set it's its value. |
Context parameters for Groovy Scripts
This table details the available context parameters you can leverage within your scripts. Please see Sample Groovy Scripts to Create/Update Asset workflow post function for more examples.
Variable Name | Description |
---|---|
issue | Access current issue. Instance of |
originalIssue | Access the original issue before the transition. Instance of |
ComponentAccessor | Access JIRA components. See https://docs.atlassian.com/software/jira/docs/api/latest/index.html?com/atlassian/jira/component/ComponentAccessor.htmlRefer to the Atlassian documentation. |
customFieldManager | Access JIRA Custom Field Manager class. See https://docs.atlassian.com/software/jira/docs/api/latest/index.html?com/atlassian/jira/issue/CustomFieldManager.htmlRefer to the Atlassian documentation. |
loggedInUser | ApplicationUser instance for current logged in user. See https://docs.atlassian.com/software/jira/docs/api/latest/index.html?com/atlassian/jira/user/ApplicationUser.html Example: loggedInUser == issue.getAssignee() |
DefaultIssueChangeHolder | Default implementation of a change holder. It is used to update a custom field. |
aipUtils | Helper class for the post function groovy script. See aipUtils for details |
...