How to pass custom variables through webhooks
Now, you can define custom variables in ARN template JQLs and pass their value from a Webhook URL parameter.
Use case this tries to solve is - if the external application has some additional parameter that is also available in Jira. e.g. passing labels from the external application.
Let’s see the steps:
Step 1
Create/edit any type of template in ARN
In the JQL section within the template, include a custom variable in the JQL like this. [labelName] is the custom input variable below.
project = "[projectId]" and fixVersion ="[versionId]" and labels = "[labelName]"
Step 2
When a template with such JQL is added to a rule triggered by Webhook, you can pass the value of this custom variable in the Webhook URL parameter like this.
https://arn.upraise.io/arn/executewebhook/42256/b5b995e3-adfbb1b-4bf9-adda-efae0dda458b?versions=10000&labelName=ARN
While passing values of custom variables in the webhook URL, spaces and special characters should be replaced with relevant URL encoded values.
Example : If the value of a labels field is “ARN & Roadmap Portal”, then it will be passed in the webhook URL like this:
JQL : project = "[projectId]" and fixVersion ="[versionId]" and labels = "[labelName]"
You can use any online service like this to convert the variable value in valid format.
Important points to note
Like version variable, passing value of custom variable in the Webhook URL is optional and rule would still get triggered when additional parameter is not passed.
Like version variable, you can include multiple variables for the same field in the JQL and then pass their corresponding values in the Webhook URL.
Example: Value of two labels field variables (ARN & Upraise) is passed in Webhook URL belowJQL :
projoect="[projectId]" and fixVersion ="[versionId]" and labels in ("[labelName]","[labelName1]")
You can exclude version variable altogether and only use custom variable like this :
JQL :projoect="[projectId]" and labels = "[labelName]"
Webhook:
https://arn.upraise.io/arn/executewebhook/42256/b5b995e3-bb1b-4bf9-adda-efae0dda458b?labelName=ARNYou can include multiple such custom variables in the JQL and pass their values to Webhook URL
Example: Value of a labels field (ARN) and component field (Rules) is passed in Webhook URL below
JQL :In case the template has multiple JQLs and the custom variable is included only in a few of them, system shall ignore the custom variable passed in Webhook for the JQLs in which that custom variable is not included.
In case of custom variables for user picker fields like assignee, and reporter, while passing their value in the webhook URL, use their Jira account id instead of Jira user names.
Example : in below JQL, if you have to pass a variable value for the Jira user “John W”, you have to use his Jira account Id.
JQL :There is no change in template preview screen and users will not be able to pass value to custom variables through the template preview action.