Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

How to populate a multi-select field in Jira webhook

Bernard Carpio
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Oct 20, 2023

Hi, 

I'm setting up a Jira webhook to create Jira Issue from third party application (ie. Postman), everything is ok except for the multi-select field. The department field is not populating.

Webhook Call from Postman:

{
"data": {
"title": "hello 10 October Test",
"description": "hello .. this is the description",
"department": ["Ford", "BMW", "Fiat"]
}
}

From Jira webhook setup, I used the "More Options" and add the field:

{

"fields":

{ "customfield_10108": [{"value": {{webhookData.department}}}]

}

}

May I know if anyone can explain how can I implement this.

Thanks!

Bernard

 

 

 

1 answer

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 20, 2023

Hi @Bernard Carpio -- Welcome to the Atlassian Community!

You are trying to create the JSON for a multi-select, custom field: https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/#Multi-select-custom-field

To make that easier you could use the asJsonObjectArray() function to populate the expression: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-json-functions/#asJsonObjectArray-keyName-

Kind regards,
Bill

Bernard Carpio
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Oct 26, 2023 • edited

Hi Bill,

I tried to use the asJsonObject() function but I can't save and publish the webhook. Here is the script:

{
"fields": {
"customfield_10107": [
{{#webhookData.application.asJsonObjectArray("value")}}
]
}
}

I have this error while publishing the webhook.

Error while parsing additional fields - Failed to close 'webhookData.application.asJsonObjectArray("value")' tag

Please take note #webhookData.application this field is coming from our third party application to save into our Jira.

Can help which I have missed out?

Thanks!

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 26, 2023

When you use the function asJsonObjectArray() it returns most of the syntax needed, and so you do not need the brackets wrapping it.

And, you appear to have added an # for iteration but that is also handled by the function.

Please try this instead:

{
"fields": {
"customfield_10107": {{webhookData.application.asJsonObjectArray("value")}}
}
}

If that does not work, please add a write to the audit log (using the Log action) to learn what this contains:

Application data: {{webhookData.application}}

That will confirm if you are accessing the correct attribute(s) with the function.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events