I am trying ro run this script in order to add automaticly Favorite Filters
I need to add automaticly to users all the Favorite Filters i created
I think the error in this line:Long portalPageId
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.favourites.FavouritesManager
import com.atlassian.jira.portal.PortalPage
import com.atlassian.jira.portal.PortalPageManager
import com.opensymphony.user.UserManager
// Set the portal page ID and group to share with here
Long portalPageId = 10151
String shareWith = "jira-users"
ComponentManager componentManager = ComponentManager.getInstance()
FavouritesManager favouritesManager = (FavouritesManager) componentManager.getComponentInstanceOfType(FavouritesManager.class)
PortalPageManager portalPageManager = (PortalPageManager) componentManager.getComponentInstanceOfType(PortalPageManager.class)
PortalPage portalPage = portalPageManager.getPortalPageById(portalPageId)
UserManager userManager = UserManager.getInstance()
for (String userId in userManager.getGroup(shareWith).getUsers()) {
favouritesManager.addFavourite(userManager.getUser(userId), portalPage)
}
I am getting this error :
javax.script.ScriptException: com.atlassian.jira.util.dbc.Assertions$NullArgumentException: entity should not be null!
Stack Trace: |
javax.script.ScriptException: javax.script.ScriptException: com.atlassian.jira.util.dbc.Assertions$NullArgumentException: entity should not be null! |
Solved by Jamie Echlin
https://answers.atlassian.com/questions/4687/request-working-script-to-favorite-issue-on-behalf-of-all-users
Have you verified that the value you specify for portalPageId is correct? Odds are, it's wrong and hence the null value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
how do I get all the saved filters ,what value should i assign to Long portalPageId to get all the saved filters?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you trying to share filters or dashboards? The code you are running is designed to make a specific dashboard (PortalPage) a favourite for the specific users, not a filter.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Penny ) where have you been?
I am trying to share Filters (favorite filters )
The script provided in the earlier comment seems to be provided for use with dashboards and not for issue filters. I believe this can be done with little modifications in the script
Can you please help me..I am really stuck !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried this:
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.favourites.FavouritesManager
import com.atlassian.jira.portal.PortalPage
import com.atlassian.jira.portal.PortalPageManager
import com.opensymphony.user.UserManager
// Set the portal page ID and group to share with here
Long portalPageId = 10151
String shareWith = "carla"
ComponentManager componentManager = ComponentManager.getInstance()
FavouritesManager favouritesManager = (FavouritesManager) componentManager.getComponentInstanceOfType(FavouritesManager.class)
PortalPageManager portalPageManager = (PortalPageManager) componentManager.getComponentInstanceOfType(PortalPageManager.class)
PortalPage portalPage = portalPageManager.getPortalPageById(portalPageId)
UserManager userManager = UserManager.getInstance()
for (String userId in userManager.getGroup(shareWith).getUsers()) {
favouritesManager.addFavourite(userManager.getUser(userId), portalPage)
}
i get
Result: |
no return value |
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.