How to find the companyId in Liferay.
In liferay many services require comapanyId. In lifeay company means portal instance. You can find this easily.
To find the company ID (portal instance ID), follow these steps:
1/ Sign into portal as admin user
2/ Navigation the Portal Instances admin page
Navigation Path is "Dockbar > Admin > Control Panel > (Configuration) Portal Instances
3/ Review first column "Instance ID"
The instance ID is the company ID.
Enjoy.......
Get comapanyId in code:
- PortalUtil.getDefaultCompanyId(); this give you default companyId.
- PortalUtil.getCompanyId(request); here request means HttpServletRequest.
- PortalUtil.getCompanyId(portletRequest);here portletRequest means any portletRequest(Render,Action or Resource).
- ThemeDisplay themeDisplay=(ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);themeDisplay.getCompanyId();
- Get current companyId from specific thread local storage by:
CompanyThreadLocal.getCompanyId();
Get comapanyId manually:
To find the company ID (portal instance ID), follow these steps:
1/ Sign into portal as admin user
2/ Navigation the Portal Instances admin page
Navigation Path is "Dockbar > Admin > Control Panel > (Configuration) Portal Instances
3/ Review first column "Instance ID"
The instance ID is the company ID.
Enjoy.......
Comments
Post a Comment