UpdateJiraIssue
Description
This processor uses Jira REST API to update an existing issue in JIRA. The user needs to specify the Jira issue identifier.
Issue comment, label, summary and description can be set using processors' properties.
Additional Jira issue attributes can be supplied through Dynamic Properties on the processor.
Authentication
The Jira server may require the client to authenticate itself, in order to update issues in Jira.
This processor supports authentication through Personal Access Token, in
case of Jira Server, and user e-mail & API token, in case of Jira Cloud.
The credential must be provided in the same format, as Jira presents it to the user. Providing an invalid token might result in either error
messages, or empty responses, depending on the access policy configuration on the server side.
Multi-type properties
The following properties can be plain strings, EL expressions and RecordPaths. In case of RecordPath evaluation
the @{Property Value} format shall be used. First always the Expression Language is evaluated, then the RecordPath.
- Issue Identifier
- Issue Summary
- Issue Description
- Issue Label
- Issue Comment
Additional Dynamic Properties can be defined on the processor in the following format to supply custom Jira attributes:
- Dynamic Property Key: /fields/additionalProperties/0/additionalProperty - JsonPointer expression which specifies the JSON path the value will
be inserted to. It is important to notice that the array notation differs from the RecordPath expressions. E.g.
/project/addresses/0/street.
In case a scalar value needs to be modified, use fields as the first element of the path. E.g. /fields/priority/name.
In case an array value needs to be changed, use update as the first element of the path and append the operation (add, remove) at the end
of the path, e.g. /update/labels/0/add .
- Dynamic Property Value: @{/inputJson/.../value} - Multi-type format, it can either be a simple plain value, EL or
a RecordPath that directs to the field within the incoming records. This field will then be placed into the location
specified by the Dynamic Property Key.
Examples
This is how the basic JSON looks like that the processor sends to JIRA. In case a Record Reader is not set,
this is the expected format of the incoming FlowFile. More examples can be found
here.
{
"fields": {
"summary": "testSummary",
"description": "testDescription"
},
"update": {
"labels": [
{
"add": "testLabel"
}
],
"comment": [
{
"add": {
"body": "testComment"
}
}
]
}
}
When Record Reader is set, the 'Issue Label', 'Issue Summary', 'Issue Comment' and 'Issue Description'
properties can be used to either extract values from the incoming records, provide EL or constant values.
The processor will construct a JSON based on these property values and send it to the Jira platform for
issue update.
In this example based on the incoming records, we set the "summary", "description" and "comment" attributes of the JSON above.
If there's an incoming FlowFile with the following content:
{
"title": "UpdateJiraIssue",
"resolution": "Done",
"tasks": [
{
"description": "Update an existing Jira issue",
"comment": "Update the Jira issue based on the recent changes."
}
]
}
The most important issue properties should be set first on the processor:
- Issue Summary: @{/title}
- Issue Description: @{/tasks[0]/description}
- Issue Comment: @{/tasks[0]/comment}
We're also going to define a Dynamic Property.
- Dynamic Property 1 Key: /fields/customfield_1024/value
- Dynamic Property 1 Value: @{/resolution}
Note: The first token, "fields" denotes that customfield_1024 field's value will be set.
In case of array value, the first token should be "update".
The final JSON then is sent to the JIRA server for issue update.
{
"fields" : {
"summary" : "UpdateJiraIssue",
"description" : "Update an existing Jira issue",
"customfield_1024" : {
"value" : "Done",
}
},
"update" :
"comment" : [ {
"add" : {
"body" : "Update the Jira issue based on the recent changes."
}
} ]
}
}