Wednesday, 19 September 2012

Using Liferay Services in VM using ServiceLocator

When developing custom themes, we need to use Liferay services in VM. Its quite easy but tricky. So, putting here a simple example-
Write following in init-custom.vm

#set($organizationLocalService = $serviceLocator.findService("com.liferay.portal.service.OrganizationLocalServiceUtil"))


Now you can use this service as follows:


#set ($org = $organizationLocalService.getOrganization($myPlace.getClassPK()))
where $myPlace is a group.


Hope this will help.

No comments:

Post a Comment