How to get global (company) group id in Liferay?

Mark picture Mark · Aug 21, 2012 · Viewed 30.2k times · Source

How to get the global (company) group id in Liferay without accessing ThemeDisplay?

P.S.: with ThemeDisplay it is simple: themeDisplay.getCompanyGroupId().

Answer

user832497 picture user832497 · Aug 21, 2012

When you have only one Company in your portal:

Company company = CompanyLocalServiceUtil.getCompanyByMx(PropsUtil.get(PropsKeys.COMPANY_DEFAULT_WEB_ID));
long globalGroupId = company.getGroup().getGroupId();