Hi, have created a webhook, whenever the comments get created or updated, i need a customfield value in the json payload.
Am not getting the customfield value in the webhooks payload for comments updated or created.
Regds,
Subhash
Hi Subhash Kurni, welcome to the Community! That's expected: the comment_created and comment_updated webhooks only carry the comment plus a limited set of issue fields, so custom fields don't come through. Whether you can use the issue updated event instead depends on your deployment: on Data Center it still fires for comments, as Thanasis Nikolaou mentioned, but on Cloud Atlassian removed comments from the issue webhooks and jira:issue_updated no longer fires for them.
comment_created
comment_updated
jira:issue_updated
If you're on Cloud, or you'd rather keep your comment webhook, there are two ways around it:
Fetch the field when the webhook arrives. Take issue.key from the payload and call GET /rest/api/2/issue/{issueKey}?fields=customfield_10050, with your own field ID. It's one extra call per comment, and it works on both Cloud and Data Center.
issue.key
GET /rest/api/2/issue/{issueKey}?fields=customfield_10050
Build the payload yourself with Automation. A rule triggered when a comment is added, with a Send web request action, lets you define the whole body, so you can send exactly what your endpoint needs:
{ "issue": "{{issue.key}}", "comment": "{{comment.body.jsonEncode}}", "myField": "{{issue.customfield_10050}}" }
jsonEncode keeps quotes and line breaks in the comment from breaking the JSON.
jsonEncode
Hi @Subhash Kurni
That's expected. The comment_created and comment_updated payloads only carry the comment and a trimmed issue object, so custom fields aren't included. Atlassian support confirmed it here: https://community.atlassian.com/forums/Jira-questions/Select-custom-fields-are-not-showing-up-in-jira-webhooks-for/qaq-p/855807
Two easy ways round it:
Subscribe to the Issue updated event instead. It also fires when a comment is added or edited, and its payload has the full issue with all custom fields plus the comment.
Or keep your comment webhook and have the receiver call GET /rest/api/2/issue/{issueKey}?fields=customfield_XXXXX using the key from the payload.
Are you on Cloud or Data Center?
Hola Subhash,
@Germán Morales has already covered the two main approaches, but there's one detail worth considering if you decide to use Jira Automation.
Since you need to capture newly created and updated comments, you'll want to account for both. In Jira Cloud, the Work item commented trigger runs when a new comment is added, but it doesn't run when an existing comment is edited. Atlassian provides a separate Work item comment edited trigger for that purpose. You can find both triggers documented here
One other consideration is the type of custom field you're trying to retrieve. Depending on whether it's a text field, select list, or another field type, you may need to reference a specific property of the field to obtain the value you want in your JSON payload.
Are you using Jira Cloud or Data Center, and what type of custom field are you trying to retrieve? Also, does the custom field value need to be included in the original webhook payload, or would retrieving it through a separate REST API request work for your integration?
Thanks,
James
It looks like you're new here. Sign in or register to get started.