Incoming Webhook to Create Issue and Set Field Values
Asked by David Quiram:

I will preface this with I have good experience with Jira Automation, but no experience with JSON and have been trying to piece this process together.

We're currently trying to understand the fundamentals of getting an incoming webhook to create a ticket and place values in specific fields.

To be clear, our automation creates a new issue, but it doesn't place data into the fields.

We have an external form in Caspio and have setup a webhook to be sent to our JSM when a form is submitted. We would like this webhook to take the data from the form and place it in corresponding fields in our JSM.

I've bounced around several different pages trying to understand this, but the documentation isn't clear enough for me to piece together. From reading [Working With Incoming Webhook Data in Automation for Jira](https://confluence.atlassian.com/jirakb/working-with-incoming-webhook-data-in-automation-for-jira-1125878776.html) I understand that I will need to use the {{webhookData}} smartvalue, but I'm not understanding **where** to use that smartvalue.

Here is my setup for context.

++Caspio Webhook Custom Payload:++

![2023-12-11 17_33_56-_Caspio JSON Payload - Notepad.png](/t5/image/serverpage/image-id/296270iBFF4A1403ACEDD79/image-size/large?v=v2&px=999 "2023-12-11 17_33_56-_Caspio JSON Payload - Notepad.png")

++Result of Webhook Payload:++ This screenshot was from one of my early tests. This proves that the correct data is being pulled from Caspio and sent along in the payload. I know I will have an issue with the dueDate field as the data isn't formatted correctly. That's a 'future DQ problem'.

++![2023-12-11 17_34_25-Webhook.site - Test, process and transform emails and HTTP requests.png](/t5/image/serverpage/image-id/296271iDBD533FD38C2FDAC/image-size/large?v=v2&px=999 "2023-12-11 17_34_25-Webhook.site - Test, process and transform emails and HTTP requests.png")++

++JSM Automation:++

![2023-12-11 17_38_07-Automation - Jira.png](/t5/image/serverpage/image-id/296273i95BEEA46C1DF8366/image-size/large?v=v2&px=999 "2023-12-11 17_38_07-Automation - Jira.png")

I'm showing the 'Additional Fields' section to show I don't have anything in it. Given that my previous tests of this configuration will create an issue, but not put data in the fields, I'm going make a wild assumption that we need to use the 'Additional Fields' section?   

Is this were we would use the {{webhookData}} smart value? If so how?


Answers:
author: Fernando Eug?nio da Silva
body: [@David Quiram](/t5/user/viewprofilepage/user-id/4501008)

Trying to give a brief explanation. You just need to understand basic indentation concepts.

Let me explain:

Your JSON carries a payload in this order: **Fields** \> **Partner Survey Organization Name**

A structure to use webhook if I want to retrieve this value in a field, I must pass the webhook variable with the field indentation. It would look something like this: **{{webhookData.fields.Partner Survey Organization Name}}**

**WebhookData** = Data Collected

**Fields** = Entering inside the JSON fields structure

**Partner Survey Organization Name** = Is the name of the field inside the response I want to collect

Do you understand that I am declaring the value that Organization Name brings?

In the next fields, just follow the same example, changing the reference field.

You can put this in a custom field in your automation or declare it all in the 'description' field.

If you already have custom fields to consume this information, click on 'Choose fields to set' in your automation, choose the field and within the field define the corresponding webhookData variable that fills this field.

Repeat this for the remaining fields.

Hope this helps you

comments: author: David Quiram
body: [@Fernando Eug?nio da Silva](/t5/user/viewprofilepage/user-id/4606715) thank you for your response. This does help me understand the indentation better.

I do have custom jira fields for all these pieces of data. I added the fields in my create new issue element, and put the smart value like this. Like before it creates my issue, but will not put the data into the Jira fields.

![2023-12-12 13_55_27-Automation - Jira.png](https://community.atlassian.com/t5/image/serverpage/image-id/296462i3870DD48D27B1CF5/image-size/large?v=v2&px=999 "2023-12-12 13_55_27-Automation - Jira.png")

Do I need to first create the issue and then edit the issue later in the automation? Or do I need to add double quotes around the field names since some of them contain spaces? If that was the case I would think that at least the budget and due date fields pictured above would have worked with the rest failing...


author: Fernando Eug?nio da Silva
body: [@David Quiram](/t5/user/viewprofilepage/user-id/4501008)

Could you share your audit log details? Jus to see what is the exactly error your automation is displaying.


author: David Quiram
body: [@Fernando Eug?nio da Silva](/t5/user/viewprofilepage/user-id/4606715)

That's the odd thing. It not failing. It's just not doing what I would expect.

![2023-12-12 16_29_11-Automation - Jira.png](https://community.atlassian.com/t5/image/serverpage/image-id/296498iC8965100FAA9EC6F/image-size/large?v=v2&px=999 "2023-12-12 16_29_11-Automation - Jira.png")


author: Fernando Eug?nio da Silva
body: [@David Quiram](/t5/user/viewprofilepage/user-id/4501008)

How Jira collect your webhook data? In your automation rule there is some GET web request to collect those datas?

As you're using webhook values, this values needs to be intended by your rule either using an associated webhook or using a web request with GET / POST in your automation.


author: David Quiram
body: So as I mentioned in the original post. We are using Caspio, a low code database, to send the webhook and custom payload to our JSM project. The start of our automation is the webhook trigger.

![2023-12-14 13_41_18-IT Help Desk - Details - Service project - Jira.png](https://community.atlassian.com/t5/image/serverpage/image-id/296904i47A48950F8448BCD/image-size/large?v=v2&px=999 "2023-12-14 13_41_18-IT Help Desk - Details - Service project - Jira.png")

I tried using Caspio's default payload, but it errors in the automation because of the structure. This is why we opted to try using a custom payload and I thought we were formatting in a way that Jira would be able to understand and use.

I feel like this IS being read by Jira, because when I forgot to add the (jiraDate) format variable to the smart value in the Jira automation, it would throw an error that the format of the due date was incorrect, because it does contain a timestamp coming from Caspio.

![2023-12-14 13_34_17-Caspio - Webhooks.png](https://community.atlassian.com/t5/image/serverpage/image-id/296901i24462805EDACA9FC/image-size/large?v=v2&px=999 "2023-12-14 13_34_17-Caspio - Webhooks.png")![2023-12-14 13_34_10-Caspio - Webhooks.png](https://community.atlassian.com/t5/image/serverpage/image-id/296902i272094AE2E1F0191/image-size/large?v=v2&px=999 "2023-12-14 13_34_10-Caspio - Webhooks.png")


author: David Quiram
body: I ended up reaching out to Support on this issue and they were able to assist a little further and put things into a better context with the automation side of things.

Adding a log function with {{webhookData.fields}} is huge to just see the data coming in.

The other thing was my formatting of the values in the create issue step was slightly off.


Tags: cloud

jira-service-management

jira-service-management-cloud