As the question...for a specific user using a Jython script
I have tried using the [UserHistoryManager Class|http://docs.atlassian.com/software/jira/docs/api/4.2/com/atlassian/jira/user/UserHistoryManager.html ], but have been unsucessful.
We are using Jira v4.4.5
This is something that is definitely not recommended. It may be possible to do this via the database access.
Definitely Backup your database first.
I believe the tables you'll want to take a look at are the:
I clean like this
def isPreview = true /* That script clean last view activity, just in case it was related to the performance degradation in Jira Service Desk and Jira Software for the 10k+ */ import com.atlassian.jira.user.ApplicationUser; import com.atlassian.jira.user.UserHistoryItem; import com.atlassian.jira.user.UserHistoryManager; import com.atlassian.jira.component.ComponentAccessor; import com.atlassian.jira.user.UserHistoryItem.*; import com.atlassian.jira.bc.user.search.UserSearchService import com.atlassian.jira.bc.user.search.UserSearchParams import com.atlassian.jira.user.ApplicationUser import org.apache.log4j.Logger import org.apache.log4j.Level def log = Logger.getLogger("com.gonchik.scripts.groovy.cleanupLastViewHistoryForInactiveUsers") log.setLevel(Level.DEBUG) boolean cleanForActiveUsers = false // This script shows how to clean up the history items from inactive users UserSearchService userSearchService = ComponentAccessor.getComponent(UserSearchService.class) UserSearchParams userSearchParams = (new UserSearchParams.Builder()).allowEmptyQuery(true).includeActive(cleanForActiveUsers).includeInactive(true).maxResults(100000).build() def userHistoryManager = ComponentAccessor.getComponent(UserHistoryManager.class) def sb = new StringBuilder() for (ApplicationUser appUser : userSearchService.findUsers("", userSearchParams)) { List<UserHistoryItem> recentUserHistory = userHistoryManager.getHistory(UserHistoryItem.ASSIGNEE, appUser); if (!isPreview){ userHistoryManager.removeHistoryForUser(appUser) } sb.append("${appUser.name}<br/>\n") } return sb.toString()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your response David. We have a custom field to gather information about about a tree of improvements under a given feature (done via Jython). It makes some time computations in the process via a virtual (not a person) user account. The problem is the flooding of information in the history due to this. Wonder if anyone knows a Jython or Java based solution for this problem, than at database level.
I have already found out the tables affected by the change, but thanks for re-assuring the list.
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.