Reputation: 1145
I'm trying to set up some automation using Jenkins and Jira Trigger plugin for Jenkins. I've set up a web hook at Jira side which is able to invoke build on Jenkins as desired.
I've a trouble with obtaining value for a custom field from incoming Jira request.
I'm trying to use "Issue Attribute Path" feature and I've also referred to post (How to use the 'Issue attribute path' in the parameter mapping of jenkins-trigger-plugin)
Howevevr I'm still unable to get value for custom fields customfield_10010
, customfield_10011
. I've tried with mapping like fields.customfield_10010
, fields.customfield_10010.value
, fields.customfield_10010.0.value
,customfield_10010.0.value
and similar combinations. I'm able to get value for other standard fields as suggested in plugin help. ex: status.name
, description
etc.
I could not get any clue from Jira documentation site either.
Parts of incoming json data is below for easy reference.
"issue": {
"id": "1000x",
"self": "http://localhost:3080/rest/api/2/issue/10007",
"key": "ABC-2",
"fields": {
"issuetype": {
..
},
"parent": {
..
},
"components": [
],
"timespent": null,
"timeoriginalestimate": 28800,
"description": ".....",
"project": {
..
},
"customfield_10010": [
{
"self": "http://localhost:3080/rest/api/2/customFieldOption/10019",
"value": "ABC-Custom 1",
"id": "10019"
}
],
"fixVersions": [
],
"customfield_10011": [
{
"self": "http://localhost:3080/rest/api/2/customFieldOption/10021",
"value": "ABC-Custom 2",
"id": "10021"
}
],
.....
....
....
}
}
Upvotes: 3
Views: 1754
Reputation: 636
You can get the value of a custom field with the following syntax:
fields.find { it.id == "customfield_10010" }.value
I had the same problem and found this solution here: https://issues.jenkins-ci.org/browse/JENKINS-13216
Upvotes: 2