Hi,
I would like to create issues with Jira automation and set their attributes based on the content of a variable (myVariable).
myVariable is created at the beginning of the automation rule and set to:
{
"epic": {
"epicname": "audit finding",
"summary": "audit finding",
"assignee": "XY"
},
"stories": [
{
"summary": "Update document #1",
"status": "Backlog",
"duedate": "30/Apr/25"
},
{
"summary": "Update document #2",
"status": "In Progress",
"duedate": "30/Apr/25"
},
{
"summary": "Update document #3",
"status": "To Do",
"duedate": "30/Apr/25"
}
]
}
During the creation of the epic and stories I wanted to set the attributes as follows:
{{ myVariable.epic.summary}}
{{ myVariable.stories[0].summary}}
Both of them are empty, therefore the issue creation failed.
Could you please tell me how can I use the fields of the JSON format variable to set the attributes of the issues in Jira automation rule?
Thank you in advance for you help!
Short answer: a created variable is plain text and cannot be parsed as JSON. Here is a suggestion to add that feature: https://jira.atlassian.com/browse/AUTO-138
If you want to store the information you show in a created variable, text and list functions would be needed to parse it, and possibly use the advanced branch to iterate over any lists of values (e.g., the Story information you show).
Another option is ignore the variable and the rule could instead just call the create issue actions to set the fields.
If instead you eventually plan to get that text / data from a REST API call with the Send Web Request action (or Incoming Webhook Trigger), the data might be in a JSON format with attributes which can be parsed.
Kind regards,
Bill
Hi @Bill Sheboy,
Thank you for your quick answer!
I'm going to implement the proposed solution.
I tried to use the jsonStringToObject() function.
The first row returns the proper value, but the second function doesn't return anything.
Is it a wrong approach?
{{jsonStringToObject(variableIssueProperty).epic.summary}}
{{jsonStringToObject(variableIssueProperty).stories[0].summary}}
Kind regards,
Zsigmond
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please use the get() function to access a list element within an automation rule (or use an iterator or branch).
For example:
{{jsonStringToObject(variableIssueProperty).stories.get(0).summary}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bill,
Thank you for your help!
The solution you suggested works perfectly.
Kind regards,
Zsigmond
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Using smart variables in Jira automation is such a powerful approach. It is really streamlines workflows and makes issue creation more dynamic and customizable.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.