I'm trying to create a listener script that will listen for fixVersions field update, and will copy its new value into a custom field.
Does anyone done such a script and can share it?
I am failing at the retrieval of the fixVersions value:
def fixVersionsChange = changelog?.items.find { it['field'] == 'fixVersions' }
logger.info("fixVersions value is: {}", fixVersionsChange)
Running the above, results with:
2019-07-30 16:38:14.514 INFO - fixVersions value is: null
The above script is working well on custom fields.
Any ideas?
Hi Did you ever get an answer to this ? I too am trying to capture the added or removed fixversion ( on an epic .. so that i can update all its epic linked children )
Hi Alex,
Thank you for your question.
I have just tested your code and added in an extra log statement to log out the whole of the changelog paramater when updating a fix version.
I noticed that in the changelog that was returned the field was called Fix Version rather than fixVersions.
Could I please ask you to try to updating your code to find the field named Fix Version as after doing this I was able to get the value of the changelog for fix versions logged out.
If this response has answered your question can you please mark it as accepted so that other users can see it is correct when searching for similar answers.
Regards,
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kristian,
I changed the field as you suggested:
def DeliveryDateChange = changelog?.items.find { it['field'] == 'Fix Version' }
logger.info("fixVersions is: {}", DeliveryDateChange)
When I’m changing the fixVersions (Fix Version) from 2.1.1 to 2.2, I’m getting the following response:
2019-08-04 06:16:51.526 INFO - fixVersions is: {field=Fix Version, fieldtype=jira, fieldId=fixVersions, from=10036, fromString=2.1.1, to=null, toString=null}
It is not recognizing the toString value
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alex,
I have just done a test and confirm that the toString value is only populated when a fix version already exists and a new version is added.
This is the way that the changelog returned by Atlassian works and ScriptRunner is just returning this data.
The reason appears to be that the change log is only showing what value was removed from the field and you would need to then get the value of the fix version of the field after the update in order to see what the latest version of the field is.
Regards,
Kristian
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.