i am having a custom field of type TextField . so when ever i modify the custom field i have to know the old values as well as new values of the custom field .
kind Regards
Naren
In the listener, you will get the event and you can get the Changelog from it. From the changelog, you will get the changegroup id and use it to fetch all the relevant changeitems.
GenericValue changelog = event.getChangelog(); Long changeGroupId = changelog.getLong("id") List<GenericValue> changeItems = delegator.findByAnd("ChangeItem",EasyMap.build("group", changeGroupId));
Now, iterate over the changeItems and get oldvalue, oldstring, newvalue and newstring to find the changes! field will get you the fieldname.
Hi
Thanks for the code .It works for me in the edit screen when ever i edit my customfield (ex:textcustomfield) first but when i edit my customfield after editing the other custom fields then my change items are different.
Below is my description with an example:
i have 2 custom field userpicker and textfield
case 1: If i edit my text custom field first and userpicker custom field second then i will get changte items for text custom field
case 2: If i edit userpicker custom field first and my text custom field second then i will get change items for userpicker custom field
so can u plzz give me the code where if i edit my text custom field either first or last , i should get change items for my text custom field
thanks & regards
Naren
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It doesn't matter in which order you edit, you will have a changeItem for each change you make. It seems you are only getting the first changeItem in the list. Get all the changeItems using the groupid, iterate through it and find the one for your custom field. As you can see changeItems is a list!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
thank u very much , i was able to get the list of change items .iterated and got the result.Problem resolved .thanks once again
regards
Naren
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jobin, where do I get the "delegator" .. I am runnign script runner --> custom listener I tried : changeLog.internalDelegator.findByAnd ===> no luck this.delegator ==> no luck --Ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I got it from OfBizDelegator delegator = ComponentAccessor.getOfBizDelegator() List<GenericValue> changeItems = delegator.findByAnd("ChangeItem",MapBuilder.build("group", changeGroupId)); ==Worked
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Every issue has a history tab which shows all the changes to all fields of that issue. See http://confluence.atlassian.com/display/JIRA044/Viewing+an+Issue%27s+Change+History
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the help , But i required as java code like when ever my custom field is updated my boolean value should be equal to true
......plz help me
Regrds
Naren
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Java code? How are you accessing Jira? REST or SOAP? And I guess in both the issue history is not available.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If your code is in a listener, then the changes are listed in the event that the listener catches. Similarly for a post-function - they're in the muteableissue object.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am using a listener . In the Listener i want a java code where i can know whether the custom field value is changed or not
if changed my boolean variable should be true . If not changed my boolean value should be false .
I am having issue update event listener but it works for all updates in the issue . So i want only for a particular text field ..
Thanks
Naren
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.