How Do I Sync PR Reviewer and Jira Custom field?

Alexandra Anghelescu
Contributor
August 21, 2023

I am trying to do something similar to this How Do I Sync PR Reviewer and Jira Assignee? (atlassian.com). However instead of Assignee, I have a custom field called "Code Reviewer" (can be multiple users). 

I am having a hard time setting the custom field value from the webhookData, it's expecting something like this format (I cannot pick the field from the list, so have to set it manually):

{
"fields": { "Code Reviewer": ??? }
}

 

jira-webhook.png

I am not sure what the ??? should be, I tried many variations like this
"Code Reviewer":{{webhookData.pullrequest.reviewers.account_id.asJsonArray}} , I am also not sure webhookData is coming in as a json or xml ? 

2 answers

1 accepted

2 votes
Answer accepted
Alexandra Anghelescu
Contributor
August 22, 2023

figured it out (also use the customfield id not the description of the field)

{"fields": {
    "customfield_10129"  {{webhookData.pullrequest.reviewers.account_id.asJsonObject("id").asJsonArray}}

}}

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events