Hi,
first a little bit of context:
I'm automating a process using JIRA as kind of a workflow-management system.
The scenario is as follows:
A user fills out a form, which is displayed on the companies website.
On submission, a HTTP POST to a Jira webhook adress is sent.
This triggers an automation rule that creates a new issue, starting a
HR process based on the information provided by the form.
My mission is to map the JSON form-data to custom fields upon issue creation,
so that the relevant process participant can act according to the data supplied.
As stated by the documentation here its possible to access the JSON payload via {{webhookData}}
and set custom fields upon issue creation based on their supported types and operations.
When I tried this to set a custom field with properties {"type": "string"} and "operations[0]: set"
{
"fields": {
"customfield_10060": {
"set": "{{webhookData.someData}}"}
}
}
or
{
"fields": {
"customfield_10060": {
"value": "{{webhookData.someData}}"}
}
}
the automation rule didnt run with the error message:
jira operation value must be a string.
Then I tried "customfield_10060": {
"value": "someString"}
and "customfield_10060": {"set": "someString"}
which also led to the same error.
But when I did this, based on a stackoverflow post
{
"fields": {
"customfield_10060": "{{webhookData.someString}}"
}
}
the rule executed properly, creating the issue and setting the custom field with the incoming JSON data.
Why is this, whats the mechanism behind it?
Where can I find documentation about this kind of behavior?
I wanna know how to set custom fields of type array or date,
without guessing the solution.
Hi @N Y -- Welcome to the Atlassian Community!
The method used in the JSON expression to set the custom field value depends upon the custom field's type.
In my experience when the custom field value doesn't set, it is either because the wrong location is being source from the webhook data (or API response), or because the incorrect custom field type is assumed for the JSON expression. I recommend writing the source data to the audit log when you are unsure what Jira is trying to parse.
Please refer again to that documentation you noted as it shows examples of the various types: https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/
There are also some JSON functions to help when parsing the webhook data, as described here: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-json-functions/
For cascading and Insight fields, there is additional documentation linked to those same pages.
Kind regards,
Bill
Hi Bill,
thank you!
The JSON functions are really helpful,
and you're absolutely right, the documentation page provides examples to my question at the end.
I obviously overlooked the part, probably because I was searching for a more general answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.