This post is in continuation with my previous question -
I am able to get the different values related to the issue and have included those in my custom email template. Now in the template itself I want to be able to show a table titled - "Change Fields" inside which I will show all those fields whose values/content has been changed on transition. I want to find the previous value(before transition) held by the changed fields and also the current value(post transition). Any documentation or tutorial about such functions would also help.
Thank you.
Edit - Any thoughts guys? On transition from one state to another I want to find what properties(for eg., description, priority, attachment) of an issue has been changed and show the old values of the properties as well the new one. Please help.
Use
event.getChangeLog()
more details here - http://stackoverflow.com/questions/36668135/how-to-get-a-list-of-modified-fields-with-scriptrunner-on-issueupdated-event
@Tarun Sapra getting an error - No such property: event for class
Also, I am writing this script directly into the web based editor of Post Functions where I am putting the content in HTML format.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Tarun Sapra The above error comes when I try to trigger the custom email Post Function on transition. But if I go into the editor and provide the issue key and do a Preview then it works fine.
The other way I found is to use - changeHistoryManager and get old, new value for each field, compare it and show the changed ones as follows -
def changeHistoryManager = com.atlassian.jira.component.ComponentAccessor.getChangeHistoryManager()
def created = changeHistoryManager.getChangeItemsForField(issue, "summary")
Any thoughts? Or better way than this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Arpan, but does your approach guarantee that the old value of the field is the one which is just before the value after transition, as there could have been many transition before the present transition
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Tarun Sapra Thanks Tarun for pointing that out. Yes it is not fetching the most recent value. Instead all values are fetched.
Other than that, I dont know why I get an error on "event" keyword.
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.