Jira Cloud Automation FixVersion from the user input

Szymon F January 9, 2024

Hi, I am struggling with the automation that is quite straightforward.

 

I have issue A, the automation starts from the Action button. The popus asks for the fixVersion to be provided and once it is completed the linked issue is created, lets call it issue B.

 

Here is the automation

Screenshot 2024-01-09 at 13.54.44.png

and the specified value for the fixVersion in the issue B:

 

{
"fields": {
"fixVersions": [{ "value" : "{{userInputs.{{BackportFV}}}}" }]
}
}

The automation creates the Backport issuetype but the fixVersion field does not populate to issue B FixVersion field. No errors in the audit log. Any hints?

 

I also tried to add a new component and edit the issue. Then the same code removes the FixVersion from the original ticket.  

1 answer

1 accepted

1 vote
Answer accepted
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.
January 9, 2024

Hi @Szymon F 

To set the Fix Version values with JSON the attribute is "name" and not "value".  Please look here for more information: https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/#Fix-Versions

If that does not work, please post images of your Create Issue action and of the audit log details showing the rule execution.  Those may provide context to explain what you are observing.  Thanks!

Kind regards,
Bill

Szymon F January 10, 2024

Hi @Bill Sheboy ,

thank you for the suggestion - I did try that already but then the logs looked like this:

Screenshot 2024-01-10 at 11.40.35.png

Important note that the fixVersion exists in the project so the automation does not create it by itself.

 

Here is the automation: 

Screenshot 2024-01-10 at 11.42.35.png

Screenshot 2024-01-10 at 11.42.08.png

Szymon F January 10, 2024

I also made a change in the code based on your suggestion from the post: https://community.atlassian.com/t5/Jira-Software-questions/automation-Add-fix-version-to-existing-fix-version-when-creating/qaq-p/1821136 

 

{
"update": {
"fixVersions": [
{
"add": {
"name": "{{userInputs.{{BackportFV}}}}"
}
}
]
}
}

 but this also threw an error:

Screenshot 2024-01-10 at 11.53.30.png

 


Another try with the hardcoded version id:

{
"fields": {
"fixVersions": [{ "id" : "17827" }]
}
}

works and the FixVersion is assigned to the new ticket

 


Another one, I saw somewhere that instead of the code I should be able to update the field in the SET option. But the smart value is not visible here: 

Screenshot 2024-01-10 at 12.24.16.png

example here


I also put the code into the Description field:

1. {{userInputs.BackportFV}}
2. {{userInputs.{{BackportFV}}}}

and here is the outcome in the ticket:

1.

2. }}

 

so first of all the variable should be {{userInputs.BackportFV}} 

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.
January 10, 2024

Thanks for that information, and I see some extra curly brackets in your smart value expressions which need adjustments.

First in your manual trigger, when defining a variable name, it does not include the brackets.  Please remove those and only use BackportFV for the variable name.  Later when it is referenced, it would include the brackets, like this: {{userInputs.BackportFV}}

And so the JSON needs updates also.  Please try this one to set the value:

{
"fields": {
"fixVersions": [
{ "name": "{{userInputs.BackportFV}}" }
]
}
}

As the rule is creating a new issue, the update is not used (because the issue does not exist yet).

Szymon F January 11, 2024

Hi @Bill Sheboy the removal of extra brackets solved the problem. 

Thank you for your help!

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events