Forums

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

Copy old value of fix version field using project automation

Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 31, 2023 edited

Hi Guys,

Need your help in automation.

I want to capture old value of Fix version in another field. 

Rule is running for edit issue trigger >> When new value added/remove from Fix version field, older value will update in Single line text field. I am using below smart value but it's not updating the field.Kindly suggest  :-

{{issue.changelog.fixVersions.toString}}

 Note :- Using Automation for JIRA DC

2 answers

2 accepted

2 votes
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 31, 2023

Hello @Vikrant Yadav 

I was looking at the documentation for Smart Values and specifically for {{changelog}} for DC here:

https://confluence.atlassian.com/automation/jira-smart-values-issues-993924860.html

I think that your syntax is not correct. The examples in the document look like this:

{{#changelog.summary}}
  {{toString}}
{{/}}
{{#changelog.issuetype}}
  {{fromString}}
{{/}}
// Previous status name
{{#changelog.status}}{{fromString}}{{/}}
// Previous status id (for using in another Edit action
{{#changelog.status}}{{from}}{{/}}

Additionally the document says it is not available with all triggers, so there may not be changelog information when using the Field Value Changed trigger.

I did some experimenting in my Jira Cloud instance with Field Value Changed and Issue Updated triggers and the format shown above, and was not able to get any output from the changelog for the fixVersions field. For Jira Cloud the documentation also says that the fields available in the change log are limited. I don't know if that might be the case in Automation for Jira DC also.

Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 31, 2023

Hi @Trudy Claspill ,

Thanks for your response!

I tested this as well :- {{#changelog.fixVersion}}{{toString}}{{/}} but it won't give any response and not update the field. 

I tried this as well {{fieldChange.fromString}} , it works sometime and sometime it doesn't work. When i remove a single fix version sometime it works but when multiple fix version it breaks.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 1, 2023

Trying to think of other options...

It is not pretty, but you could use two custom fields.

Each time Fix Version changes, write the contents of field #1 to field #2. Then write the contents of Fix Versions to Field #1. Field #2 would always have the value before the last change to the field.

Like Vikrant Yadav likes this
Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 3, 2023

@Trudy Claspill How do I copy the value? If I use post function or automation it copy the current value to Field 2. Can you please share the trigger and action which I need to setup for this? 🙏

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 3, 2023

For my custom fields I created two Version multi-select fields.

The TRIGGER for the rule is Field Value Changed for the Fix Versions field.

After that I created two Condition: IF/Else blocks

If field1 is not empty
Then copy field1 to field2
Else
Set field2 to nothing

ACTION: Re-fetch data

If Fix Versions is not empty
Then copy Fix Versions to field1
Else
Set field1 to nothing

 Here's an example of the first If/Else

Screen Shot 2023-02-03 at 10.25.15 AM.png

 

This is Edit Issue Fields #1

Screen Shot 2023-02-03 at 10.26.30 AM.png

 

And this is Edit Issue Fields #2

Screen Shot 2023-02-03 at 10.27.12 AM.png

 

The second If/Else block would be similar but 

- substitute Fix Versions for Current Fix Versions

- substitute Current Fix Versions for Previous Fix Versions

Like Vikrant Yadav likes this
Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 6, 2023

Hi @Trudy ClaspillThanks for the solution!

2 votes
Answer accepted
Samuel Gatica _ServiceRocket_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 31, 2023

Hi @Vikrant Yadav 

 

Unfortunately, there is no workaround currently. 

Here is a linked defect:  https://jira.atlassian.com/browse/JSWCLOUD-22815 

Best regards

Sam

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 31, 2023

Yes, and...

Here is the related defect for automation, which covers both Jira Cloud and Server/Data Center versions of the symptom: https://jira.atlassian.com/browse/JIRAAUTOSERVER-207

Please note, you may observe changelog intermittently working for fixVersion.  I found through testing there are very specific paths by which it still works and it randomly fails for others.  IMHO: this one is quite broken  :^)

Kind regards,
Bill

Like Vikrant Yadav likes this
Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 31, 2023

Thanks @Bill Sheboy  and @Samuel Gatica _ServiceRocket_  
yep, there is no workaround for this right now. 

Any alternate solution, you would like to suggest. I have Scriptrunner and JMWE 

What is the result of this value :-  {{triggerissue.fixVersions.name}} ?

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events