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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to include custom field values in Webhook custom payload

Hi there

We have a requirement to pass custom field values to an external application and our plan is to use the Webhook automation rule to support this.

I can't seem to get smart values to post as part of the JSON payload.

Any help appreciated.

Thanks

Andrea

Screenshot 2020-10-07 at 13.03.23.png.

1 answer

1 accepted

0 votes
Answer accepted
Andy Heinzer Atlassian Team Oct 08, 2020

Hi Andrea,

I see that you are trying to setup an automation rule in order to send a json payload, but this is not working as expected.  From looking at your screenshot of the configuration, it looks like you're trying to setup a rule that will create a new request in a Jira Service Desk project.

Your json payload looks to be close, but you need to encapsulate the smart value in double quotes.  You can see an example of the payload needed in the REST API example of POST /rest/servicedeskapi/request.

Try changing that one line to

"summary": "{{issue.customfield_10131}}"

In turn that should pass the value of that field on this issue into summary field, so long as that custom field is just a text field with some value.  If this is a different kind of custom field, such as a select list, or cascade select list, you might find that the output looks a bit different here.  And if this field has no value, you might find that the json payload is empty for that particular webhook.

I always like to use a service like https://postb.in/ when testing out my webhooks to make sure that the payload I expect I am sending is actually being received by the endpoint.  It makes for a useful means to test out webhooks.

Andy

Thanks for your response Andy.

I'm still getting blank values when using the custom field smart value within the JSON.

As a workaround, I've added an action before the Send Web Request action, to post the custom field value as a comment.

I'm then using the "{{issue.comments.last.body}}" within the JSON, and this passes.

It does seem weird that the JSON isn't picking up the value from the custom field however.Screenshot 2020-10-09 at 10.50.19.png

Andy Heinzer Atlassian Team Oct 09, 2020

I am not expecting that you would need to use the .value postfix like you have in your most recent screenshot here.  That does not show the value the field has, but rather .value is documented in Smart values - general as showing a property value.  Such property values are null by default, but could be used by apps/addons in Jira in order to store some kind of meta-data about the field/issue/project/etc.

I would try change your description from

"{{issue.customfield_10081.value}}"

to just

"{{issue.customfield_10081}}"

in order to show the current value that custom field has.

 

If that does not work as expected, instead of trying to identify the field by the unique 5 digit identifier, perhaps you could just use the name of the field for the smart value, such as

"{{issue.MyCustomFieldName}}"

 

And if that doesn't work as expected here, then I have a few questions for you to try to learn more here:

  1. What type of field is this custom field in question? (Single line Text, multi-line text, select list, number, label, etc)
  2. Is this a next-gen project?

Try the first two alternatives above, and if that doesn't work, please let me know more.

Andy

Hi Andy

Neither of the suggestions appear to offer a solution unfortunately.

The two fields I have created for each scenario are text fields, so from everything I've read, they should be able to be used.

Project type is Classic.

Thanks

Andrea

Thanks for the suggestions, it worked for me. I am able to get the custom fields data

Have now been able to successfully post using smart value {{issue.MyCustomFieldName}} to various endpoints.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
Community showcase
Published in Jira Service Management

Why upgrade to Jira Service Management Premium?

We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan.  &nb...

196 views 1 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you