Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JIRA automation incoming webhook running JQL with custom field

Lukáš Meitner
Contributor
February 27, 2022

Hi all,

Based on automation, I try to integrate two instances (for this purpose I will call them instance A and instance B) of JIRA. In the instance A, I have an automation (Automation 1) sending a POST request to create an issue in the instance B. The instance B listening the webhook URL (Automation 2) and creates an issue. Into a custom field "External issue Key" saves a key of an issue from the instance A. Then, I'd like to synchronize an issue key from the instance B to a custom filed "External issue Key" (customfield_10110) into the instance A. So I created a new incoming webhook automation in the instance A, which runs by a JQL search:
key = "{{webhookData.fields.customfield_10110}}"

JIRA1.PNG
and a POST request in the Automation 2 (so the automation creates the issue, saves the issue key into the "External issue Key" field and sends the request with custom data) which sends key and customfield_10110:

JIRA2.PNG

Unfortunately, I receive an error with details:
Incoming webhook trigger failed to run JQL search:
"(key = "") AND (project in (10142))" - The issue key '' for field 'key' is invalid.

I am starting to be mad, I tried a milion of variants of the JQL, included "key", "issue", "issuekey", "{{webhookData.fields.customfield_10110... fields.customfield_10110.value... issue.customfield... etc. but did not hit the right one. I tried to send whole issue data in the Automation 2.

I was seeking for some documentation of smart values, webhookData and custom fields in JQL running incoming webhook, or community discussions, but nothing found, nothing helped.

Please, any idea how to resolve it?

Thank you very much.

2 answers

1 accepted

0 votes
Answer accepted
Lukáš Meitner
Contributor
March 1, 2022

In the chain of actions: recieve incoming webhook call -> create an issue -> send web request; the request I try to construct worked with data from the incoming webhook, not from the created issue. When I added a new branch into the automation right after the create action, limited the branch by a JQL ("External issue key" ~ "{{webhookData.key}}"), and moved the send web request action into the branch, the automation will start to read issue data, so that it can put a value from the "External issue key" field stored in the issue. See bellow:

JIRA3.PNG

The result is, that the JQL serch running the Automation 1 returns non empty value from "{{webhookData.fields.customfield_10110}}" and it is able to identify an issue, where I want to add a value into the "External issue key" field.

Best regards, Lukas

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.
February 28, 2022

Hi @Lukáš Meitner 

That error message seems to indicate the field/location in the {{webhookData}} is empty.

Have you tried to remove the JQL search on the trigger (switching to the "No issues from the webhook" option), and just write the webhookData to the audit log?  That may confirm if the information has what you expect.

Kind regards,
Bill

Lukáš Meitner
Contributor
March 1, 2022

Hi  @Bill Sheboy

see bellow, I found a solution.

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer