Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Abhi Ed
Error in getting groupID
December 26, 2012 8:43 AM
Answer

Abhi Ed

Rank: Regular Member

Posts: 118

Join Date: June 4, 2012

Recent Posts

Hello friends ,

ThemeDisplay ThemeDisplay themeDisplay =
(ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);= (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);

In my code , themeDisplay.getScopeGroupId() is returning me default liferay's community groupID , not my community's groupID.

Am i doing sth wrong?
Apoorva Prakash
RE: Error in getting groupID
December 27, 2012 4:23 AM
Answer

Apoorva Prakash

Rank: Liferay Master

Posts: 659

Join Date: June 15, 2010

Recent Posts

Abhi Ed:
Hello friends ,

ThemeDisplay ThemeDisplay themeDisplay =
(ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);= (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);

In my code , themeDisplay.getScopeGroupId() is returning me default liferay's community groupID , not my community's groupID.

Am i doing sth wrong?


Are you sure, you are placing the portlet on your community's page?
Dhrutika Vyas
RE: Error in getting groupID
December 27, 2012 10:36 PM
Answer

Dhrutika Vyas

Rank: Expert

Posts: 438

Join Date: February 9, 2009

Recent Posts

First of all it seems that your code is having some issues.

themedisplay.getScopeGroupId() will give your current group on which your are.

So make sure that you have placed it at proper place.

Regards,
Dhrutika
Vishal Panchal
RE: Error in getting groupID
December 27, 2012 11:06 PM
Answer

Vishal Panchal

Rank: Expert

Posts: 280

Join Date: May 20, 2012

Recent Posts

Abhi Ed:
Hello friends ,

ThemeDisplay ThemeDisplay themeDisplay =
(ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);= (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);

In my code , themeDisplay.getScopeGroupId() is returning me default liferay's community groupID , not my community's groupID.

Am i doing sth wrong?


Hi, You may try something like below code snippet it will give you your community's groupID.

long groupID= GroupLocalServiceUtil.getGroup(companyId,"CommunityName").getGroupId();

Thanks&Regards,
Vishal R. Panchal
Abhi Ed
RE: Error in getting groupID
December 28, 2012 1:12 AM
Answer

Abhi Ed

Rank: Regular Member

Posts: 118

Join Date: June 4, 2012

Recent Posts

Yeah I did it in ur way Vishal. emoticon
Apoorva Prakash
RE: Error in getting groupID
December 28, 2012 9:40 AM
Answer

Apoorva Prakash

Rank: Liferay Master

Posts: 659

Join Date: June 15, 2010

Recent Posts

Abhi Ed:
Yeah I did it in ur way Vishal. emoticon


The way Vishal suggested it very correct, but it will always return the groupId of the hardcoded community name, not the current community's ID.

Hope this will help...

Thanks and Regards,
Apoorva Prakash