...
Go to the desired transition of your workflow, switch to the Post functions tab, and click the Add post function link.
Locate the EIS - Create Confluence Page using a template page post function.
Click on the Add button.
Step 2:
...
Post function name
Give your post function a descriptive name.
Step 3: Create script condition
You can create a decision to execute the REST according to the result of Groovy script.
...
By default, it can only return true statement. However, you can type your script and return true; to execute REST, or return false; to not execute. Here is a sample code of how you can type your own script:
...
Condition code example:
Code Block | language | groovy
---|
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.user.ApplicationUser ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().loggedInUser log.info("current user:" + currentUser.username) def reporter = issue.reporter.username log.info("reporter: " + reporter) return reporter.equals(currentUser.username) |
Step 4: Fill in REST service details
In this section, REST details are filled.
URL – The endpoint of the REST service. You can type any dynamic parameter here using double curly braces (e.g. http://mycompany.com/api/book/{{bookId}} assuming bookId is defined in the Parameters section which is described below).
Method – Select Http Method (GET, POST, PUT, DELETE).
Headers – Define your HTTP header key/value sets on separate lines as shown in the screenshot.
Request Body – Type json request body. You can use dynamic parameters here as well.
...
Authorization Type: Choose authorization type - currently BASIC Authentication is supported.
Credential: If you choose any Authorization Type, this option becomes active and the credentials you defined in the Credentials section will be listed. Below is an example:
Step
...
5: Configure a post function (Optional)
In this section, you can configure the post function to update a custom field based on a value in the REST response.
Check the Update custom field box to update a custom field based on the REST response.
Select the custom field you want to update from the dropdown.
Enter a JSONPath expression to specify the value within the response to update the field with. Leave empty if you want to use the entire response body. For JSONPath examples, see the JSONPath examples page.
Step
...
6: Run asynchronously (Optional)
In this section, you can enable async to execute the REST service asynchronously. There are a couple of reasons why you may want to execute asynchronously:
...
Save your changes to the workflow.
Publish the workflow for the changes to take effect.
...