Page portal Id

Samir Freelance
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 27, 2011

From where i can retreive the page portal id ? in order to assign all saved favorite filter on behalf of all users

I am running this script and selected user Carla but i want to runit for all users

Result:
no return value

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 = 10308
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)
}

3 answers

1 accepted

3 votes
Answer accepted
Penny Wyatt (On Leave to July 2021)
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 27, 2011

Samir, you have asked this same question (or variations thereof) four times in the last few hours.

https://answers.atlassian.com/questions/4693/page-portal-id

https://answers.atlassian.com/questions/4243/how-to-add-automaticly-favorite-filters

https://answers.atlassian.com/questions/4510/script-runner-error-long-portalpageid

https://answers.atlassian.com/questions/4687/request-working-script-to-favorite-issue-on-behalf-of-all-users

Please keep similar comments to a single question - you'll find:

* You'll get much better responses when people understand the context,

* Others with similar problems in the future can find all the answers they need in one place, and

* People who are not interested in the question can skip it easily.

I am going to close this question, for this reason.

1 vote
Betsy Walker
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 27, 2011

The script is looking for members of the group you specifed as the value for shareWith. If carla is a user name rather than a group name, then it won't work.

Also portalPageId should be set to the id of the dashboard page you want to share. From the bottom line of your screenshot, it's "10200".

BTW, is there (or shouldn't there be) a limit as to how many questions one person can ask? Enough already. :-/

Samir Freelance
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 27, 2011

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

So i need one working script for Filters and not dashboard

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 27, 2011

BetsyW >BTW, is there (or shouldn't there be) a limit as to how many questions one person can ask?

No, there shouldn't be a limit. Questions to which the answer is "what does your log say", "here's the documentation" or "LMGTFY" should be limited though...

0 votes
Samir Freelance
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 27, 2011

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events